'Imports RustemSoft.DataGridColumns
Imports System.Drawing
Imports System.Drawing.Printing
Imports System.Text
Imports System
Imports System.Collections
Imports System.Management
Imports System.IO
Imports System.ComponentModel
Imports System.Windows.Forms
Imports System.Configuration

Public Class frmRetailInvReturn
    Inherits System.Windows.Forms.Form
    Dim RtLogin As frmPosMain
    Dim GridRows As Integer
    Dim GrossTotal As Decimal
    Dim DisTotal As Decimal
    Dim TotQty As Decimal


    Dim SavedID As Integer
    Dim OriginalPrice As String
    Dim PrinterEnabled As Integer
    Dim PoleEnabled As Integer
    Dim DrawerEnabled As Integer
    Dim PosPrinterName As String
    Dim PolePrinterName As String
    Public ShowroomID As Integer = ConfigurationManager.AppSettings("ShowroomID")
    Public WarehouseID As Integer = ConfigurationManager.AppSettings("WarehouseID")
    Friend WithEvents GroupPanel1 As DevComponents.DotNetBar.Controls.GroupPanel
    Friend WithEvents Label6 As System.Windows.Forms.Label
    Friend WithEvents Label8 As System.Windows.Forms.Label
    Friend WithEvents tbSingleTog As System.Windows.Forms.Label
    Friend WithEvents Label10 As System.Windows.Forms.Label
    Friend WithEvents Label17 As System.Windows.Forms.Label
    Friend WithEvents Label19 As System.Windows.Forms.Label
    Friend WithEvents Label24 As System.Windows.Forms.Label
    Friend WithEvents cmdClose As DevComponents.DotNetBar.ButtonX
    Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox
    Friend WithEvents Label45 As System.Windows.Forms.Label
    Friend WithEvents Label44 As System.Windows.Forms.Label
    Friend WithEvents Label41 As System.Windows.Forms.Label
    Friend WithEvents Label40 As System.Windows.Forms.Label
    Friend WithEvents Label43 As System.Windows.Forms.Label
    Friend WithEvents Label37 As System.Windows.Forms.Label
    Friend WithEvents Label39 As System.Windows.Forms.Label
    Friend WithEvents Label42 As System.Windows.Forms.Label
    Friend WithEvents Label36 As System.Windows.Forms.Label
    Friend WithEvents Label38 As System.Windows.Forms.Label
    Friend WithEvents Label35 As System.Windows.Forms.Label
    Friend WithEvents Label34 As System.Windows.Forms.Label
    Friend WithEvents Label33 As System.Windows.Forms.Label
    Friend WithEvents Label32 As System.Windows.Forms.Label
    Friend WithEvents Label31 As System.Windows.Forms.Label
    Friend WithEvents Label30 As System.Windows.Forms.Label
    Friend WithEvents Label29 As System.Windows.Forms.Label
    Friend WithEvents Label28 As System.Windows.Forms.Label
    Friend WithEvents Label27 As System.Windows.Forms.Label
    Friend WithEvents Label26 As System.Windows.Forms.Label
    Friend WithEvents Label25 As System.Windows.Forms.Label
    Friend WithEvents Label5 As System.Windows.Forms.Label
    Public TerminalID As Integer = ConfigurationManager.AppSettings("TerminalID")

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents dgReturnList As System.Windows.Forms.DataGrid
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents Label7 As System.Windows.Forms.Label
    Friend WithEvents Label11 As System.Windows.Forms.Label
    Friend WithEvents Label12 As System.Windows.Forms.Label
    Friend WithEvents Label16 As System.Windows.Forms.Label
    Friend WithEvents txtNetAmt As System.Windows.Forms.TextBox
    Friend WithEvents txtCode As System.Windows.Forms.TextBox
    Friend WithEvents txtDescription As System.Windows.Forms.TextBox
    Friend WithEvents txtLineQty As System.Windows.Forms.TextBox
    Friend WithEvents txtLinePrice As System.Windows.Forms.TextBox
    Friend WithEvents txtLineDiscP As System.Windows.Forms.TextBox
    Friend WithEvents txtLineDiscA As System.Windows.Forms.TextBox
    Friend WithEvents txtLineTotalAmt As System.Windows.Forms.TextBox
    Friend WithEvents txtGrossAmt As System.Windows.Forms.TextBox
    Friend WithEvents txtDiscAmt As System.Windows.Forms.TextBox
    Friend WithEvents txtDiscP As System.Windows.Forms.TextBox
    Friend WithEvents txtPayBack As System.Windows.Forms.TextBox
    Friend WithEvents txtRtnInvDate As System.Windows.Forms.TextBox
    Friend WithEvents lblPosCusName As System.Windows.Forms.Label
    Friend WithEvents ttPos As System.Windows.Forms.ToolTip
    Friend WithEvents PrintDocument1 As System.Drawing.Printing.PrintDocument
    Friend WithEvents txtRtnInvNo As System.Windows.Forms.TextBox
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents PrintDialog1 As System.Windows.Forms.PrintDialog
    Friend WithEvents Label22 As System.Windows.Forms.Label
    Friend WithEvents txtTotalPaid As System.Windows.Forms.TextBox
    Friend WithEvents Label13 As System.Windows.Forms.Label
    Friend WithEvents txtChqNo As System.Windows.Forms.TextBox
    Friend WithEvents txtChqPaid As System.Windows.Forms.TextBox
    Friend WithEvents Label14 As System.Windows.Forms.Label
    Friend WithEvents Label15 As System.Windows.Forms.Label
    Friend WithEvents txtCashPaid As System.Windows.Forms.TextBox
    Friend WithEvents txtGVPaid As System.Windows.Forms.TextBox
    Friend WithEvents Label20 As System.Windows.Forms.Label
    Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
    Friend WithEvents lblSaleTog As System.Windows.Forms.Label
    Friend WithEvents txtCrAmtPaid As System.Windows.Forms.TextBox
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents txtCustNameorComment As System.Windows.Forms.TextBox
    Friend WithEvents lblNamePrompt As System.Windows.Forms.Label
    Friend WithEvents txtTotQty As System.Windows.Forms.TextBox
    Friend WithEvents Label4 As System.Windows.Forms.Label
    Friend WithEvents lblSuspend As System.Windows.Forms.Label
    Friend WithEvents txtSuspend As System.Windows.Forms.TextBox
    Friend WithEvents txtDiscTot As System.Windows.Forms.TextBox
    Friend WithEvents txtProdId As System.Windows.Forms.TextBox
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container()
        Me.dgReturnList = New System.Windows.Forms.DataGrid()
        Me.txtRtnInvDate = New System.Windows.Forms.TextBox()
        Me.Label2 = New System.Windows.Forms.Label()
        Me.Label7 = New System.Windows.Forms.Label()
        Me.txtNetAmt = New System.Windows.Forms.TextBox()
        Me.txtCode = New System.Windows.Forms.TextBox()
        Me.txtDescription = New System.Windows.Forms.TextBox()
        Me.txtLineQty = New System.Windows.Forms.TextBox()
        Me.txtLinePrice = New System.Windows.Forms.TextBox()
        Me.txtLineDiscP = New System.Windows.Forms.TextBox()
        Me.txtLineDiscA = New System.Windows.Forms.TextBox()
        Me.txtLineTotalAmt = New System.Windows.Forms.TextBox()
        Me.txtGrossAmt = New System.Windows.Forms.TextBox()
        Me.Label11 = New System.Windows.Forms.Label()
        Me.txtDiscAmt = New System.Windows.Forms.TextBox()
        Me.Label12 = New System.Windows.Forms.Label()
        Me.txtDiscP = New System.Windows.Forms.TextBox()
        Me.Label16 = New System.Windows.Forms.Label()
        Me.txtPayBack = New System.Windows.Forms.TextBox()
        Me.lblPosCusName = New System.Windows.Forms.Label()
        Me.ttPos = New System.Windows.Forms.ToolTip(Me.components)
        Me.PrintDocument1 = New System.Drawing.Printing.PrintDocument()
        Me.txtRtnInvNo = New System.Windows.Forms.TextBox()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.PrintDialog1 = New System.Windows.Forms.PrintDialog()
        Me.Label22 = New System.Windows.Forms.Label()
        Me.txtTotalPaid = New System.Windows.Forms.TextBox()
        Me.Label13 = New System.Windows.Forms.Label()
        Me.txtChqNo = New System.Windows.Forms.TextBox()
        Me.txtChqPaid = New System.Windows.Forms.TextBox()
        Me.Label14 = New System.Windows.Forms.Label()
        Me.Label15 = New System.Windows.Forms.Label()
        Me.txtCashPaid = New System.Windows.Forms.TextBox()
        Me.txtGVPaid = New System.Windows.Forms.TextBox()
        Me.Label20 = New System.Windows.Forms.Label()
        Me.GroupBox1 = New System.Windows.Forms.GroupBox()
        Me.cmdClose = New DevComponents.DotNetBar.ButtonX()
        Me.txtCustNameorComment = New System.Windows.Forms.TextBox()
        Me.txtDiscTot = New System.Windows.Forms.TextBox()
        Me.txtSuspend = New System.Windows.Forms.TextBox()
        Me.lblSuspend = New System.Windows.Forms.Label()
        Me.Label4 = New System.Windows.Forms.Label()
        Me.lblNamePrompt = New System.Windows.Forms.Label()
        Me.txtTotQty = New System.Windows.Forms.TextBox()
        Me.txtCrAmtPaid = New System.Windows.Forms.TextBox()
        Me.Label3 = New System.Windows.Forms.Label()
        Me.lblSaleTog = New System.Windows.Forms.Label()
        Me.txtProdId = New System.Windows.Forms.TextBox()
        Me.GroupPanel1 = New DevComponents.DotNetBar.Controls.GroupPanel()
        Me.Label6 = New System.Windows.Forms.Label()
        Me.Label8 = New System.Windows.Forms.Label()
        Me.tbSingleTog = New System.Windows.Forms.Label()
        Me.Label10 = New System.Windows.Forms.Label()
        Me.Label17 = New System.Windows.Forms.Label()
        Me.Label19 = New System.Windows.Forms.Label()
        Me.Label24 = New System.Windows.Forms.Label()
        Me.GroupBox2 = New System.Windows.Forms.GroupBox()
        Me.Label45 = New System.Windows.Forms.Label()
        Me.Label44 = New System.Windows.Forms.Label()
        Me.Label41 = New System.Windows.Forms.Label()
        Me.Label40 = New System.Windows.Forms.Label()
        Me.Label43 = New System.Windows.Forms.Label()
        Me.Label37 = New System.Windows.Forms.Label()
        Me.Label39 = New System.Windows.Forms.Label()
        Me.Label42 = New System.Windows.Forms.Label()
        Me.Label36 = New System.Windows.Forms.Label()
        Me.Label38 = New System.Windows.Forms.Label()
        Me.Label35 = New System.Windows.Forms.Label()
        Me.Label34 = New System.Windows.Forms.Label()
        Me.Label33 = New System.Windows.Forms.Label()
        Me.Label32 = New System.Windows.Forms.Label()
        Me.Label31 = New System.Windows.Forms.Label()
        Me.Label30 = New System.Windows.Forms.Label()
        Me.Label29 = New System.Windows.Forms.Label()
        Me.Label28 = New System.Windows.Forms.Label()
        Me.Label27 = New System.Windows.Forms.Label()
        Me.Label26 = New System.Windows.Forms.Label()
        Me.Label25 = New System.Windows.Forms.Label()
        Me.Label5 = New System.Windows.Forms.Label()
        CType(Me.dgReturnList, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.GroupBox1.SuspendLayout()
        Me.GroupPanel1.SuspendLayout()
        Me.GroupBox2.SuspendLayout()
        Me.SuspendLayout()
        '
        'dgReturnList
        '
        Me.dgReturnList.BackColor = System.Drawing.Color.White
        Me.dgReturnList.BackgroundColor = System.Drawing.Color.AliceBlue
        Me.dgReturnList.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.dgReturnList.CaptionVisible = False
        Me.dgReturnList.ColumnHeadersVisible = False
        Me.dgReturnList.DataMember = ""
        Me.dgReturnList.FlatMode = True
        Me.dgReturnList.HeaderForeColor = System.Drawing.SystemColors.ControlText
        Me.dgReturnList.Location = New System.Drawing.Point(20, 113)
        Me.dgReturnList.Name = "dgReturnList"
        Me.dgReturnList.ParentRowsVisible = False
        Me.dgReturnList.ReadOnly = True
        Me.dgReturnList.RowHeadersVisible = False
        Me.dgReturnList.RowHeaderWidth = 0
        Me.dgReturnList.Size = New System.Drawing.Size(801, 263)
        Me.dgReturnList.TabIndex = 25
        Me.dgReturnList.TabStop = False
        '
        'txtRtnInvDate
        '
        Me.txtRtnInvDate.BackColor = System.Drawing.Color.White
        Me.txtRtnInvDate.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.txtRtnInvDate.CausesValidation = False
        Me.txtRtnInvDate.Location = New System.Drawing.Point(109, 14)
        Me.txtRtnInvDate.Name = "txtRtnInvDate"
        Me.txtRtnInvDate.ReadOnly = True
        Me.txtRtnInvDate.Size = New System.Drawing.Size(118, 26)
        Me.txtRtnInvDate.TabIndex = 73
        Me.txtRtnInvDate.TabStop = False
        '
        'Label2
        '
        Me.Label2.AutoSize = True
        Me.Label2.BackColor = System.Drawing.Color.Transparent
        Me.Label2.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label2.ForeColor = System.Drawing.Color.Black
        Me.Label2.Location = New System.Drawing.Point(21, 14)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(85, 18)
        Me.Label2.TabIndex = 72
        Me.Label2.Text = "Return Date "
        '
        'Label7
        '
        Me.Label7.AutoSize = True
        Me.Label7.BackColor = System.Drawing.Color.Transparent
        Me.Label7.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label7.ForeColor = System.Drawing.Color.Black
        Me.Label7.Location = New System.Drawing.Point(622, 77)
        Me.Label7.Name = "Label7"
        Me.Label7.Size = New System.Drawing.Size(31, 18)
        Me.Label7.TabIndex = 83
        Me.Label7.Text = "Net"
        '
        'txtNetAmt
        '
        Me.txtNetAmt.BackColor = System.Drawing.Color.FromArgb(CType(CType(224, Byte), Integer), CType(CType(224, Byte), Integer), CType(CType(224, Byte), Integer))
        Me.txtNetAmt.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.txtNetAmt.Location = New System.Drawing.Point(721, 73)
        Me.txtNetAmt.Name = "txtNetAmt"
        Me.txtNetAmt.ReadOnly = True
        Me.txtNetAmt.Size = New System.Drawing.Size(73, 26)
        Me.txtNetAmt.TabIndex = 84
        Me.txtNetAmt.TabStop = False
        Me.txtNetAmt.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
        '
        'txtCode
        '
        Me.txtCode.BackColor = System.Drawing.Color.White
        Me.txtCode.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.txtCode.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper
        Me.txtCode.Location = New System.Drawing.Point(20, 84)
        Me.txtCode.Name = "txtCode"
        Me.txtCode.Size = New System.Drawing.Size(173, 26)
        Me.txtCode.TabIndex = 1
        '
        'txtDescription
        '
        Me.txtDescription.BackColor = System.Drawing.Color.White
        Me.txtDescription.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.txtDescription.CausesValidation = False
        Me.txtDescription.Location = New System.Drawing.Point(195, 84)
        Me.txtDescription.Name = "txtDescription"
        Me.txtDescription.Size = New System.Drawing.Size(302, 26)
        Me.txtDescription.TabIndex = 91
        Me.txtDescription.TabStop = False
        '
        'txtLineQty
        '
        Me.txtLineQty.BackColor = System.Drawing.Color.White
        Me.txtLineQty.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.txtLineQty.Location = New System.Drawing.Point(500, 84)
        Me.txtLineQty.MaxLength = 5
        Me.txtLineQty.Name = "txtLineQty"
        Me.txtLineQty.Size = New System.Drawing.Size(60, 26)
        Me.txtLineQty.TabIndex = 2
        Me.txtLineQty.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
        '
        'txtLinePrice
        '
        Me.txtLinePrice.BackColor = System.Drawing.Color.White
        Me.txtLinePrice.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.txtLinePrice.Location = New System.Drawing.Point(563, 84)
        Me.txtLinePrice.MaxLength = 8
        Me.txtLinePrice.Name = "txtLinePrice"
        Me.txtLinePrice.Size = New System.Drawing.Size(58, 26)
        Me.txtLinePrice.TabIndex = 3
        Me.txtLinePrice.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
        '
        'txtLineDiscP
        '
        Me.txtLineDiscP.BackColor = System.Drawing.Color.White
        Me.txtLineDiscP.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.txtLineDiscP.Location = New System.Drawing.Point(623, 84)
        Me.txtLineDiscP.MaxLength = 6
        Me.txtLineDiscP.Name = "txtLineDiscP"
        Me.txtLineDiscP.Size = New System.Drawing.Size(58, 26)
        Me.txtLineDiscP.TabIndex = 4
        Me.txtLineDiscP.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
        '
        'txtLineDiscA
        '
        Me.txtLineDiscA.BackColor = System.Drawing.Color.White
        Me.txtLineDiscA.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.txtLineDiscA.Location = New System.Drawing.Point(683, 84)
        Me.txtLineDiscA.MaxLength = 8
        Me.txtLineDiscA.Name = "txtLineDiscA"
        Me.txtLineDiscA.Size = New System.Drawing.Size(58, 26)
        Me.txtLineDiscA.TabIndex = 5
        Me.txtLineDiscA.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
        '
        'txtLineTotalAmt
        '
        Me.txtLineTotalAmt.BackColor = System.Drawing.Color.White
        Me.txtLineTotalAmt.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.txtLineTotalAmt.CausesValidation = False
        Me.txtLineTotalAmt.Location = New System.Drawing.Point(743, 84)
        Me.txtLineTotalAmt.Name = "txtLineTotalAmt"
        Me.txtLineTotalAmt.ReadOnly = True
        Me.txtLineTotalAmt.Size = New System.Drawing.Size(78, 26)
        Me.txtLineTotalAmt.TabIndex = 96
        Me.txtLineTotalAmt.TabStop = False
        Me.txtLineTotalAmt.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
        '
        'txtGrossAmt
        '
        Me.txtGrossAmt.BackColor = System.Drawing.Color.White
        Me.txtGrossAmt.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.txtGrossAmt.Location = New System.Drawing.Point(723, 16)
        Me.txtGrossAmt.Name = "txtGrossAmt"
        Me.txtGrossAmt.ReadOnly = True
        Me.txtGrossAmt.Size = New System.Drawing.Size(71, 26)
        Me.txtGrossAmt.TabIndex = 105
        Me.txtGrossAmt.TabStop = False
        Me.txtGrossAmt.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
        '
        'Label11
        '
        Me.Label11.AutoSize = True
        Me.Label11.BackColor = System.Drawing.Color.Transparent
        Me.Label11.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label11.ForeColor = System.Drawing.Color.Black
        Me.Label11.Location = New System.Drawing.Point(622, 20)
        Me.Label11.Name = "Label11"
        Me.Label11.Size = New System.Drawing.Size(38, 18)
        Me.Label11.TabIndex = 104
        Me.Label11.Text = "Total"
        '
        'txtDiscAmt
        '
        Me.txtDiscAmt.BackColor = System.Drawing.Color.White
        Me.txtDiscAmt.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.txtDiscAmt.Location = New System.Drawing.Point(722, 44)
        Me.txtDiscAmt.MaxLength = 8
        Me.txtDiscAmt.Name = "txtDiscAmt"
        Me.txtDiscAmt.Size = New System.Drawing.Size(72, 26)
        Me.txtDiscAmt.TabIndex = 107
        Me.txtDiscAmt.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
        '
        'Label12
        '
        Me.Label12.AutoSize = True
        Me.Label12.BackColor = System.Drawing.Color.Transparent
        Me.Label12.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label12.ForeColor = System.Drawing.Color.Black
        Me.Label12.Location = New System.Drawing.Point(622, 52)
        Me.Label12.Name = "Label12"
        Me.Label12.Size = New System.Drawing.Size(33, 18)
        Me.Label12.TabIndex = 106
        Me.Label12.Text = "Disc"
        '
        'txtDiscP
        '
        Me.txtDiscP.BackColor = System.Drawing.Color.White
        Me.txtDiscP.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.txtDiscP.Location = New System.Drawing.Point(665, 44)
        Me.txtDiscP.MaxLength = 5
        Me.txtDiscP.Name = "txtDiscP"
        Me.txtDiscP.Size = New System.Drawing.Size(56, 26)
        Me.txtDiscP.TabIndex = 106
        Me.txtDiscP.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
        '
        'Label16
        '
        Me.Label16.AutoSize = True
        Me.Label16.BackColor = System.Drawing.Color.Transparent
        Me.Label16.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label16.ForeColor = System.Drawing.Color.Black
        Me.Label16.Location = New System.Drawing.Point(622, 102)
        Me.Label16.Name = "Label16"
        Me.Label16.Size = New System.Drawing.Size(88, 18)
        Me.Label16.TabIndex = 118
        Me.Label16.Text = "Receive Back"
        '
        'txtPayBack
        '
        Me.txtPayBack.BackColor = System.Drawing.Color.FromArgb(CType(CType(224, Byte), Integer), CType(CType(224, Byte), Integer), CType(CType(224, Byte), Integer))
        Me.txtPayBack.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.txtPayBack.CausesValidation = False
        Me.txtPayBack.Location = New System.Drawing.Point(721, 101)
        Me.txtPayBack.Name = "txtPayBack"
        Me.txtPayBack.ReadOnly = True
        Me.txtPayBack.Size = New System.Drawing.Size(73, 26)
        Me.txtPayBack.TabIndex = 117
        Me.txtPayBack.TabStop = False
        Me.txtPayBack.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
        '
        'lblPosCusName
        '
        Me.lblPosCusName.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lblPosCusName.ForeColor = System.Drawing.Color.Ivory
        Me.lblPosCusName.Location = New System.Drawing.Point(565, 178)
        Me.lblPosCusName.Name = "lblPosCusName"
        Me.lblPosCusName.Size = New System.Drawing.Size(91, 13)
        Me.lblPosCusName.TabIndex = 141
        Me.lblPosCusName.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'PrintDocument1
        '
        '
        'txtRtnInvNo
        '
        Me.txtRtnInvNo.BackColor = System.Drawing.Color.White
        Me.txtRtnInvNo.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.txtRtnInvNo.CausesValidation = False
        Me.txtRtnInvNo.Location = New System.Drawing.Point(323, 14)
        Me.txtRtnInvNo.Name = "txtRtnInvNo"
        Me.txtRtnInvNo.ReadOnly = True
        Me.txtRtnInvNo.Size = New System.Drawing.Size(120, 26)
        Me.txtRtnInvNo.TabIndex = 142
        Me.txtRtnInvNo.TabStop = False
        '
        'Label1
        '
        Me.Label1.AutoSize = True
        Me.Label1.BackColor = System.Drawing.Color.Transparent
        Me.Label1.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label1.ForeColor = System.Drawing.Color.Black
        Me.Label1.Location = New System.Drawing.Point(248, 14)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(71, 18)
        Me.Label1.TabIndex = 143
        Me.Label1.Text = "Return No"
        '
        'Label22
        '
        Me.Label22.AutoSize = True
        Me.Label22.BackColor = System.Drawing.Color.Transparent
        Me.Label22.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label22.ForeColor = System.Drawing.Color.Black
        Me.Label22.Location = New System.Drawing.Point(325, 54)
        Me.Label22.Name = "Label22"
        Me.Label22.Size = New System.Drawing.Size(38, 18)
        Me.Label22.TabIndex = 146
        Me.Label22.Text = "Total"
        '
        'txtTotalPaid
        '
        Me.txtTotalPaid.BackColor = System.Drawing.Color.White
        Me.txtTotalPaid.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.txtTotalPaid.CausesValidation = False
        Me.txtTotalPaid.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.txtTotalPaid.Location = New System.Drawing.Point(324, 75)
        Me.txtTotalPaid.Multiline = True
        Me.txtTotalPaid.Name = "txtTotalPaid"
        Me.txtTotalPaid.ReadOnly = True
        Me.txtTotalPaid.Size = New System.Drawing.Size(99, 26)
        Me.txtTotalPaid.TabIndex = 145
        Me.txtTotalPaid.TabStop = False
        Me.txtTotalPaid.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
        '
        'Label13
        '
        Me.Label13.AutoSize = True
        Me.Label13.BackColor = System.Drawing.Color.Transparent
        Me.Label13.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label13.ForeColor = System.Drawing.Color.Black
        Me.Label13.Location = New System.Drawing.Point(15, 123)
        Me.Label13.Name = "Label13"
        Me.Label13.Size = New System.Drawing.Size(57, 18)
        Me.Label13.TabIndex = 112
        Me.Label13.Text = "Chq No."
        '
        'txtChqNo
        '
        Me.txtChqNo.BackColor = System.Drawing.Color.White
        Me.txtChqNo.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.txtChqNo.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.txtChqNo.Location = New System.Drawing.Point(74, 123)
        Me.txtChqNo.Multiline = True
        Me.txtChqNo.Name = "txtChqNo"
        Me.txtChqNo.Size = New System.Drawing.Size(131, 26)
        Me.txtChqNo.TabIndex = 111
        '
        'txtChqPaid
        '
        Me.txtChqPaid.BackColor = System.Drawing.Color.White
        Me.txtChqPaid.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.txtChqPaid.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.txtChqPaid.Location = New System.Drawing.Point(88, 75)
        Me.txtChqPaid.MaxLength = 100
        Me.txtChqPaid.Multiline = True
        Me.txtChqPaid.Name = "txtChqPaid"
        Me.txtChqPaid.Size = New System.Drawing.Size(70, 26)
        Me.txtChqPaid.TabIndex = 110
        Me.txtChqPaid.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
        '
        'Label14
        '
        Me.Label14.AutoSize = True
        Me.Label14.BackColor = System.Drawing.Color.Transparent
        Me.Label14.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label14.ForeColor = System.Drawing.Color.Black
        Me.Label14.Location = New System.Drawing.Point(88, 54)
        Me.Label14.Name = "Label14"
        Me.Label14.Size = New System.Drawing.Size(62, 18)
        Me.Label14.TabIndex = 114
        Me.Label14.Text = "Chq.Amt"
        '
        'Label15
        '
        Me.Label15.AutoSize = True
        Me.Label15.BackColor = System.Drawing.Color.Transparent
        Me.Label15.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label15.ForeColor = System.Drawing.Color.Black
        Me.Label15.Location = New System.Drawing.Point(15, 54)
        Me.Label15.Name = "Label15"
        Me.Label15.Size = New System.Drawing.Size(37, 18)
        Me.Label15.TabIndex = 116
        Me.Label15.Text = "Cash"
        '
        'txtCashPaid
        '
        Me.txtCashPaid.BackColor = System.Drawing.Color.White
        Me.txtCashPaid.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.txtCashPaid.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.txtCashPaid.Location = New System.Drawing.Point(15, 75)
        Me.txtCashPaid.MaxLength = 100
        Me.txtCashPaid.Multiline = True
        Me.txtCashPaid.Name = "txtCashPaid"
        Me.txtCashPaid.Size = New System.Drawing.Size(70, 26)
        Me.txtCashPaid.TabIndex = 108
        Me.txtCashPaid.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
        '
        'txtGVPaid
        '
        Me.txtGVPaid.BackColor = System.Drawing.Color.White
        Me.txtGVPaid.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.txtGVPaid.CausesValidation = False
        Me.txtGVPaid.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.txtGVPaid.Location = New System.Drawing.Point(161, 75)
        Me.txtGVPaid.Multiline = True
        Me.txtGVPaid.Name = "txtGVPaid"
        Me.txtGVPaid.ReadOnly = True
        Me.txtGVPaid.Size = New System.Drawing.Size(70, 26)
        Me.txtGVPaid.TabIndex = 124
        Me.txtGVPaid.TabStop = False
        Me.txtGVPaid.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
        '
        'Label20
        '
        Me.Label20.AutoSize = True
        Me.Label20.BackColor = System.Drawing.Color.Transparent
        Me.Label20.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label20.ForeColor = System.Drawing.Color.Black
        Me.Label20.Location = New System.Drawing.Point(162, 54)
        Me.Label20.Name = "Label20"
        Me.Label20.Size = New System.Drawing.Size(26, 18)
        Me.Label20.TabIndex = 135
        Me.Label20.Text = "GV"
        '
        'GroupBox1
        '
        Me.GroupBox1.BackColor = System.Drawing.Color.Transparent
        Me.GroupBox1.Controls.Add(Me.cmdClose)
        Me.GroupBox1.Controls.Add(Me.txtCustNameorComment)
        Me.GroupBox1.Controls.Add(Me.txtDiscTot)
        Me.GroupBox1.Controls.Add(Me.txtSuspend)
        Me.GroupBox1.Controls.Add(Me.lblSuspend)
        Me.GroupBox1.Controls.Add(Me.Label4)
        Me.GroupBox1.Controls.Add(Me.lblNamePrompt)
        Me.GroupBox1.Controls.Add(Me.txtTotQty)
        Me.GroupBox1.Controls.Add(Me.txtCrAmtPaid)
        Me.GroupBox1.Controls.Add(Me.Label3)
        Me.GroupBox1.Controls.Add(Me.txtTotalPaid)
        Me.GroupBox1.Controls.Add(Me.Label22)
        Me.GroupBox1.Controls.Add(Me.Label11)
        Me.GroupBox1.Controls.Add(Me.Label7)
        Me.GroupBox1.Controls.Add(Me.Label20)
        Me.GroupBox1.Controls.Add(Me.Label12)
        Me.GroupBox1.Controls.Add(Me.Label16)
        Me.GroupBox1.Controls.Add(Me.txtGVPaid)
        Me.GroupBox1.Controls.Add(Me.txtDiscAmt)
        Me.GroupBox1.Controls.Add(Me.txtNetAmt)
        Me.GroupBox1.Controls.Add(Me.txtGrossAmt)
        Me.GroupBox1.Controls.Add(Me.txtDiscP)
        Me.GroupBox1.Controls.Add(Me.txtChqNo)
        Me.GroupBox1.Controls.Add(Me.txtPayBack)
        Me.GroupBox1.Controls.Add(Me.txtChqPaid)
        Me.GroupBox1.Controls.Add(Me.txtCashPaid)
        Me.GroupBox1.Controls.Add(Me.Label15)
        Me.GroupBox1.Controls.Add(Me.Label14)
        Me.GroupBox1.Controls.Add(Me.Label13)
        Me.GroupBox1.ForeColor = System.Drawing.Color.Black
        Me.GroupBox1.Location = New System.Drawing.Point(20, 376)
        Me.GroupBox1.Name = "GroupBox1"
        Me.GroupBox1.Size = New System.Drawing.Size(801, 169)
        Me.GroupBox1.TabIndex = 156
        Me.GroupBox1.TabStop = False
        '
        'cmdClose
        '
        Me.cmdClose.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton
        Me.cmdClose.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.cmdClose.Location = New System.Drawing.Point(756, 141)
        Me.cmdClose.Name = "cmdClose"
        Me.cmdClose.Size = New System.Drawing.Size(39, 23)
        Me.cmdClose.TabIndex = 181
        Me.cmdClose.Text = "X"
        '
        'txtCustNameorComment
        '
        Me.txtCustNameorComment.BackColor = System.Drawing.Color.White
        Me.txtCustNameorComment.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.txtCustNameorComment.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper
        Me.txtCustNameorComment.Location = New System.Drawing.Point(321, 123)
        Me.txtCustNameorComment.Multiline = True
        Me.txtCustNameorComment.Name = "txtCustNameorComment"
        Me.txtCustNameorComment.Size = New System.Drawing.Size(193, 26)
        Me.txtCustNameorComment.TabIndex = 126
        '
        'txtDiscTot
        '
        Me.txtDiscTot.BackColor = System.Drawing.Color.White
        Me.txtDiscTot.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.txtDiscTot.Location = New System.Drawing.Point(663, 16)
        Me.txtDiscTot.MaxLength = 10
        Me.txtDiscTot.Name = "txtDiscTot"
        Me.txtDiscTot.ReadOnly = True
        Me.txtDiscTot.Size = New System.Drawing.Size(58, 26)
        Me.txtDiscTot.TabIndex = 152
        Me.txtDiscTot.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
        '
        'txtSuspend
        '
        Me.txtSuspend.BackColor = System.Drawing.Color.White
        Me.txtSuspend.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.txtSuspend.Location = New System.Drawing.Point(146, 14)
        Me.txtSuspend.Name = "txtSuspend"
        Me.txtSuspend.ReadOnly = True
        Me.txtSuspend.Size = New System.Drawing.Size(49, 26)
        Me.txtSuspend.TabIndex = 151
        Me.txtSuspend.TabStop = False
        Me.txtSuspend.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
        '
        'lblSuspend
        '
        Me.lblSuspend.AutoSize = True
        Me.lblSuspend.BackColor = System.Drawing.Color.Transparent
        Me.lblSuspend.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lblSuspend.ForeColor = System.Drawing.Color.Black
        Me.lblSuspend.Location = New System.Drawing.Point(15, 15)
        Me.lblSuspend.Name = "lblSuspend"
        Me.lblSuspend.Size = New System.Drawing.Size(128, 18)
        Me.lblSuspend.TabIndex = 150
        Me.lblSuspend.Text = "Suspended Returns"
        '
        'Label4
        '
        Me.Label4.AutoSize = True
        Me.Label4.BackColor = System.Drawing.Color.Transparent
        Me.Label4.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label4.ForeColor = System.Drawing.Color.Black
        Me.Label4.Location = New System.Drawing.Point(411, 15)
        Me.Label4.Name = "Label4"
        Me.Label4.Size = New System.Drawing.Size(63, 18)
        Me.Label4.TabIndex = 149
        Me.Label4.Text = "Total Qty"
        '
        'lblNamePrompt
        '
        Me.lblNamePrompt.AutoSize = True
        Me.lblNamePrompt.BackColor = System.Drawing.Color.Transparent
        Me.lblNamePrompt.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lblNamePrompt.ForeColor = System.Drawing.Color.Black
        Me.lblNamePrompt.Location = New System.Drawing.Point(213, 124)
        Me.lblNamePrompt.Name = "lblNamePrompt"
        Me.lblNamePrompt.Size = New System.Drawing.Size(105, 18)
        Me.lblNamePrompt.TabIndex = 147
        Me.lblNamePrompt.Text = "CustomerName"
        '
        'txtTotQty
        '
        Me.txtTotQty.BackColor = System.Drawing.Color.White
        Me.txtTotQty.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.txtTotQty.Location = New System.Drawing.Point(480, 14)
        Me.txtTotQty.Name = "txtTotQty"
        Me.txtTotQty.ReadOnly = True
        Me.txtTotQty.Size = New System.Drawing.Size(60, 26)
        Me.txtTotQty.TabIndex = 148
        Me.txtTotQty.TabStop = False
        Me.txtTotQty.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
        '
        'txtCrAmtPaid
        '
        Me.txtCrAmtPaid.BackColor = System.Drawing.Color.White
        Me.txtCrAmtPaid.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.txtCrAmtPaid.CausesValidation = False
        Me.txtCrAmtPaid.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.txtCrAmtPaid.Location = New System.Drawing.Point(234, 75)
        Me.txtCrAmtPaid.Multiline = True
        Me.txtCrAmtPaid.Name = "txtCrAmtPaid"
        Me.txtCrAmtPaid.Size = New System.Drawing.Size(70, 26)
        Me.txtCrAmtPaid.TabIndex = 113
        Me.txtCrAmtPaid.TabStop = False
        Me.txtCrAmtPaid.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
        '
        'Label3
        '
        Me.Label3.AutoSize = True
        Me.Label3.BackColor = System.Drawing.Color.Transparent
        Me.Label3.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label3.ForeColor = System.Drawing.Color.Black
        Me.Label3.Location = New System.Drawing.Point(234, 54)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(52, 18)
        Me.Label3.TabIndex = 137
        Me.Label3.Text = "Cr. Amt"
        '
        'lblSaleTog
        '
        Me.lblSaleTog.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lblSaleTog.ForeColor = System.Drawing.Color.AliceBlue
        Me.lblSaleTog.Location = New System.Drawing.Point(365, 43)
        Me.lblSaleTog.Name = "lblSaleTog"
        Me.lblSaleTog.Size = New System.Drawing.Size(68, 11)
        Me.lblSaleTog.TabIndex = 157
        '
        'txtProdId
        '
        Me.txtProdId.BackColor = System.Drawing.Color.White
        Me.txtProdId.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.txtProdId.Location = New System.Drawing.Point(482, 12)
        Me.txtProdId.Multiline = True
        Me.txtProdId.Name = "txtProdId"
        Me.txtProdId.Size = New System.Drawing.Size(92, 26)
        Me.txtProdId.TabIndex = 158
        Me.txtProdId.Visible = False
        '
        'GroupPanel1
        '
        Me.GroupPanel1.CanvasColor = System.Drawing.SystemColors.Control
        Me.GroupPanel1.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007
        Me.GroupPanel1.Controls.Add(Me.GroupBox2)
        Me.GroupPanel1.Controls.Add(Me.GroupBox1)
        Me.GroupPanel1.Controls.Add(Me.dgReturnList)
        Me.GroupPanel1.Controls.Add(Me.txtProdId)
        Me.GroupPanel1.Controls.Add(Me.Label6)
        Me.GroupPanel1.Controls.Add(Me.txtRtnInvNo)
        Me.GroupPanel1.Controls.Add(Me.Label8)
        Me.GroupPanel1.Controls.Add(Me.txtCode)
        Me.GroupPanel1.Controls.Add(Me.txtLineTotalAmt)
        Me.GroupPanel1.Controls.Add(Me.txtRtnInvDate)
        Me.GroupPanel1.Controls.Add(Me.txtLineDiscA)
        Me.GroupPanel1.Controls.Add(Me.Label1)
        Me.GroupPanel1.Controls.Add(Me.tbSingleTog)
        Me.GroupPanel1.Controls.Add(Me.Label2)
        Me.GroupPanel1.Controls.Add(Me.txtLineDiscP)
        Me.GroupPanel1.Controls.Add(Me.Label10)
        Me.GroupPanel1.Controls.Add(Me.txtLinePrice)
        Me.GroupPanel1.Controls.Add(Me.Label17)
        Me.GroupPanel1.Controls.Add(Me.txtLineQty)
        Me.GroupPanel1.Controls.Add(Me.Label19)
        Me.GroupPanel1.Controls.Add(Me.txtDescription)
        Me.GroupPanel1.Controls.Add(Me.Label24)
        Me.GroupPanel1.Controls.Add(Me.lblPosCusName)
        Me.GroupPanel1.Dock = System.Windows.Forms.DockStyle.Fill
        Me.GroupPanel1.Location = New System.Drawing.Point(0, 0)
        Me.GroupPanel1.Name = "GroupPanel1"
        Me.GroupPanel1.Size = New System.Drawing.Size(851, 667)
        '
        '
        '
        Me.GroupPanel1.Style.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2
        Me.GroupPanel1.Style.BackColorGradientAngle = 90
        Me.GroupPanel1.Style.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground
        Me.GroupPanel1.Style.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid
        Me.GroupPanel1.Style.BorderBottomWidth = 1
        Me.GroupPanel1.Style.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder
        Me.GroupPanel1.Style.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid
        Me.GroupPanel1.Style.BorderLeftWidth = 1
        Me.GroupPanel1.Style.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid
        Me.GroupPanel1.Style.BorderRightWidth = 1
        Me.GroupPanel1.Style.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid
        Me.GroupPanel1.Style.BorderTopWidth = 1
        Me.GroupPanel1.Style.CornerDiameter = 4
        Me.GroupPanel1.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded
        Me.GroupPanel1.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center
        Me.GroupPanel1.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText
        Me.GroupPanel1.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near
        Me.GroupPanel1.TabIndex = 163
        Me.GroupPanel1.Text = "Sales Return - POS"
        '
        'Label6
        '
        Me.Label6.AutoSize = True
        Me.Label6.BackColor = System.Drawing.Color.Transparent
        Me.Label6.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label6.ForeColor = System.Drawing.Color.Black
        Me.Label6.Location = New System.Drawing.Point(21, 63)
        Me.Label6.Name = "Label6"
        Me.Label6.Size = New System.Drawing.Size(40, 18)
        Me.Label6.TabIndex = 161
        Me.Label6.Text = "Code"
        '
        'Label8
        '
        Me.Label8.AutoSize = True
        Me.Label8.BackColor = System.Drawing.Color.Transparent
        Me.Label8.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label8.ForeColor = System.Drawing.Color.Black
        Me.Label8.Location = New System.Drawing.Point(196, 63)
        Me.Label8.Name = "Label8"
        Me.Label8.Size = New System.Drawing.Size(78, 18)
        Me.Label8.TabIndex = 162
        Me.Label8.Text = "Description"
        '
        'tbSingleTog
        '
        Me.tbSingleTog.AutoSize = True
        Me.tbSingleTog.BackColor = System.Drawing.Color.Transparent
        Me.tbSingleTog.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.tbSingleTog.ForeColor = System.Drawing.Color.Black
        Me.tbSingleTog.Location = New System.Drawing.Point(501, 63)
        Me.tbSingleTog.Name = "tbSingleTog"
        Me.tbSingleTog.Size = New System.Drawing.Size(30, 18)
        Me.tbSingleTog.TabIndex = 163
        Me.tbSingleTog.Text = "Qty"
        '
        'Label10
        '
        Me.Label10.AutoSize = True
        Me.Label10.BackColor = System.Drawing.Color.Transparent
        Me.Label10.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label10.ForeColor = System.Drawing.Color.Black
        Me.Label10.Location = New System.Drawing.Point(565, 63)
        Me.Label10.Name = "Label10"
        Me.Label10.Size = New System.Drawing.Size(39, 18)
        Me.Label10.TabIndex = 160
        Me.Label10.Text = "Price"
        '
        'Label17
        '
        Me.Label17.AutoSize = True
        Me.Label17.BackColor = System.Drawing.Color.Transparent
        Me.Label17.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label17.ForeColor = System.Drawing.Color.Black
        Me.Label17.Location = New System.Drawing.Point(623, 63)
        Me.Label17.Name = "Label17"
        Me.Label17.Size = New System.Drawing.Size(47, 18)
        Me.Label17.TabIndex = 157
        Me.Label17.Text = "Disc %"
        '
        'Label19
        '
        Me.Label19.AutoSize = True
        Me.Label19.BackColor = System.Drawing.Color.Transparent
        Me.Label19.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label19.ForeColor = System.Drawing.Color.Black
        Me.Label19.Location = New System.Drawing.Point(681, 63)
        Me.Label19.Name = "Label19"
        Me.Label19.Size = New System.Drawing.Size(62, 18)
        Me.Label19.TabIndex = 158
        Me.Label19.Text = "Disc Amt"
        '
        'Label24
        '
        Me.Label24.AutoSize = True
        Me.Label24.BackColor = System.Drawing.Color.Transparent
        Me.Label24.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label24.ForeColor = System.Drawing.Color.Black
        Me.Label24.Location = New System.Drawing.Point(746, 63)
        Me.Label24.Name = "Label24"
        Me.Label24.Size = New System.Drawing.Size(38, 18)
        Me.Label24.TabIndex = 159
        Me.Label24.Text = "Total"
        '
        'GroupBox2
        '
        Me.GroupBox2.BackColor = System.Drawing.Color.Transparent
        Me.GroupBox2.Controls.Add(Me.Label45)
        Me.GroupBox2.Controls.Add(Me.Label44)
        Me.GroupBox2.Controls.Add(Me.Label41)
        Me.GroupBox2.Controls.Add(Me.Label40)
        Me.GroupBox2.Controls.Add(Me.Label43)
        Me.GroupBox2.Controls.Add(Me.Label37)
        Me.GroupBox2.Controls.Add(Me.Label39)
        Me.GroupBox2.Controls.Add(Me.Label42)
        Me.GroupBox2.Controls.Add(Me.Label36)
        Me.GroupBox2.Controls.Add(Me.Label38)
        Me.GroupBox2.Controls.Add(Me.Label35)
        Me.GroupBox2.Controls.Add(Me.Label34)
        Me.GroupBox2.Controls.Add(Me.Label33)
        Me.GroupBox2.Controls.Add(Me.Label32)
        Me.GroupBox2.Controls.Add(Me.Label31)
        Me.GroupBox2.Controls.Add(Me.Label30)
        Me.GroupBox2.Controls.Add(Me.Label29)
        Me.GroupBox2.Controls.Add(Me.Label28)
        Me.GroupBox2.Controls.Add(Me.Label27)
        Me.GroupBox2.Controls.Add(Me.Label26)
        Me.GroupBox2.Controls.Add(Me.Label25)
        Me.GroupBox2.Controls.Add(Me.Label5)
        Me.GroupBox2.ForeColor = System.Drawing.Color.FromArgb(CType(CType(192, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer))
        Me.GroupBox2.Location = New System.Drawing.Point(20, 545)
        Me.GroupBox2.Name = "GroupBox2"
        Me.GroupBox2.Size = New System.Drawing.Size(801, 83)
        Me.GroupBox2.TabIndex = 1001
        Me.GroupBox2.TabStop = False
        Me.GroupBox2.Text = "Help"
        '
        'Label45
        '
        Me.Label45.AutoSize = True
        Me.Label45.BackColor = System.Drawing.Color.Transparent
        Me.Label45.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label45.ForeColor = System.Drawing.Color.Black
        Me.Label45.Location = New System.Drawing.Point(644, 53)
        Me.Label45.Name = "Label45"
        Me.Label45.Size = New System.Drawing.Size(128, 18)
        Me.Label45.TabIndex = 104
        Me.Label45.Text = "- Recall Saved/Susp"
        '
        'Label44
        '
        Me.Label44.AutoSize = True
        Me.Label44.BackColor = System.Drawing.Color.Transparent
        Me.Label44.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label44.ForeColor = System.Drawing.Color.FromArgb(CType(CType(192, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer))
        Me.Label44.Location = New System.Drawing.Point(617, 53)
        Me.Label44.Name = "Label44"
        Me.Label44.Size = New System.Drawing.Size(29, 18)
        Me.Label44.TabIndex = 104
        Me.Label44.Text = "F12"
        '
        'Label41
        '
        Me.Label41.AutoSize = True
        Me.Label41.BackColor = System.Drawing.Color.Transparent
        Me.Label41.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label41.ForeColor = System.Drawing.Color.Black
        Me.Label41.Location = New System.Drawing.Point(333, 53)
        Me.Label41.Name = "Label41"
        Me.Label41.Size = New System.Drawing.Size(135, 18)
        Me.Label41.TabIndex = 104
        Me.Label41.Text = "- Single/Multi Toggle"
        '
        'Label40
        '
        Me.Label40.AutoSize = True
        Me.Label40.BackColor = System.Drawing.Color.Transparent
        Me.Label40.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label40.ForeColor = System.Drawing.Color.FromArgb(CType(CType(192, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer))
        Me.Label40.Location = New System.Drawing.Point(313, 53)
        Me.Label40.Name = "Label40"
        Me.Label40.Size = New System.Drawing.Size(22, 18)
        Me.Label40.TabIndex = 104
        Me.Label40.Text = "F9"
        '
        'Label43
        '
        Me.Label43.AutoSize = True
        Me.Label43.BackColor = System.Drawing.Color.Transparent
        Me.Label43.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label43.ForeColor = System.Drawing.Color.Black
        Me.Label43.Location = New System.Drawing.Point(495, 53)
        Me.Label43.Name = "Label43"
        Me.Label43.Size = New System.Drawing.Size(120, 18)
        Me.Label43.TabIndex = 104
        Me.Label43.Text = "- Customer Profile"
        '
        'Label37
        '
        Me.Label37.AutoSize = True
        Me.Label37.BackColor = System.Drawing.Color.Transparent
        Me.Label37.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label37.ForeColor = System.Drawing.Color.Black
        Me.Label37.Location = New System.Drawing.Point(30, 53)
        Me.Label37.Name = "Label37"
        Me.Label37.Size = New System.Drawing.Size(101, 18)
        Me.Label37.TabIndex = 104
        Me.Label37.Text = "- Settle Invoice"
        '
        'Label39
        '
        Me.Label39.AutoSize = True
        Me.Label39.BackColor = System.Drawing.Color.Transparent
        Me.Label39.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label39.ForeColor = System.Drawing.Color.Black
        Me.Label39.Location = New System.Drawing.Point(212, 53)
        Me.Label39.Name = "Label39"
        Me.Label39.Size = New System.Drawing.Size(92, 18)
        Me.Label39.TabIndex = 104
        Me.Label39.Text = "- Void Invoice"
        '
        'Label42
        '
        Me.Label42.AutoSize = True
        Me.Label42.BackColor = System.Drawing.Color.Transparent
        Me.Label42.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label42.ForeColor = System.Drawing.Color.FromArgb(CType(CType(192, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer))
        Me.Label42.Location = New System.Drawing.Point(469, 53)
        Me.Label42.Name = "Label42"
        Me.Label42.Size = New System.Drawing.Size(29, 18)
        Me.Label42.TabIndex = 104
        Me.Label42.Text = "F10"
        '
        'Label36
        '
        Me.Label36.AutoSize = True
        Me.Label36.BackColor = System.Drawing.Color.Transparent
        Me.Label36.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label36.ForeColor = System.Drawing.Color.FromArgb(CType(CType(192, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer))
        Me.Label36.Location = New System.Drawing.Point(8, 53)
        Me.Label36.Name = "Label36"
        Me.Label36.Size = New System.Drawing.Size(22, 18)
        Me.Label36.TabIndex = 104
        Me.Label36.Text = "F7"
        '
        'Label38
        '
        Me.Label38.AutoSize = True
        Me.Label38.BackColor = System.Drawing.Color.Transparent
        Me.Label38.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label38.ForeColor = System.Drawing.Color.FromArgb(CType(CType(192, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer))
        Me.Label38.Location = New System.Drawing.Point(191, 53)
        Me.Label38.Name = "Label38"
        Me.Label38.Size = New System.Drawing.Size(22, 18)
        Me.Label38.TabIndex = 104
        Me.Label38.Text = "F8"
        '
        'Label35
        '
        Me.Label35.AutoSize = True
        Me.Label35.BackColor = System.Drawing.Color.Transparent
        Me.Label35.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label35.ForeColor = System.Drawing.Color.Black
        Me.Label35.Location = New System.Drawing.Point(638, 25)
        Me.Label35.Name = "Label35"
        Me.Label35.Size = New System.Drawing.Size(92, 18)
        Me.Label35.TabIndex = 104
        Me.Label35.Text = "- Gift Voucher"
        '
        'Label34
        '
        Me.Label34.AutoSize = True
        Me.Label34.BackColor = System.Drawing.Color.Transparent
        Me.Label34.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label34.ForeColor = System.Drawing.Color.FromArgb(CType(CType(192, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer))
        Me.Label34.Location = New System.Drawing.Point(617, 25)
        Me.Label34.Name = "Label34"
        Me.Label34.Size = New System.Drawing.Size(22, 18)
        Me.Label34.TabIndex = 104
        Me.Label34.Text = "F6"
        '
        'Label33
        '
        Me.Label33.AutoSize = True
        Me.Label33.BackColor = System.Drawing.Color.Transparent
        Me.Label33.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label33.ForeColor = System.Drawing.Color.Black
        Me.Label33.Location = New System.Drawing.Point(488, 25)
        Me.Label33.Name = "Label33"
        Me.Label33.Size = New System.Drawing.Size(126, 18)
        Me.Label33.TabIndex = 104
        Me.Label33.Text = "- Swipe Credit Card"
        '
        'Label32
        '
        Me.Label32.AutoSize = True
        Me.Label32.BackColor = System.Drawing.Color.Transparent
        Me.Label32.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label32.ForeColor = System.Drawing.Color.FromArgb(CType(CType(192, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer))
        Me.Label32.Location = New System.Drawing.Point(468, 25)
        Me.Label32.Name = "Label32"
        Me.Label32.Size = New System.Drawing.Size(22, 18)
        Me.Label32.TabIndex = 104
        Me.Label32.Text = "F5"
        '
        'Label31
        '
        Me.Label31.AutoSize = True
        Me.Label31.BackColor = System.Drawing.Color.Transparent
        Me.Label31.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label31.ForeColor = System.Drawing.Color.Black
        Me.Label31.Location = New System.Drawing.Point(334, 25)
        Me.Label31.Name = "Label31"
        Me.Label31.Size = New System.Drawing.Size(131, 18)
        Me.Label31.TabIndex = 104
        Me.Label31.Text = "- Save/Reurn Toggle"
        '
        'Label30
        '
        Me.Label30.AutoSize = True
        Me.Label30.BackColor = System.Drawing.Color.Transparent
        Me.Label30.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label30.ForeColor = System.Drawing.Color.FromArgb(CType(CType(192, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer))
        Me.Label30.Location = New System.Drawing.Point(313, 25)
        Me.Label30.Name = "Label30"
        Me.Label30.Size = New System.Drawing.Size(22, 18)
        Me.Label30.TabIndex = 104
        Me.Label30.Text = "F4"
        '
        'Label29
        '
        Me.Label29.AutoSize = True
        Me.Label29.BackColor = System.Drawing.Color.Transparent
        Me.Label29.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label29.ForeColor = System.Drawing.Color.Black
        Me.Label29.Location = New System.Drawing.Point(213, 25)
        Me.Label29.Name = "Label29"
        Me.Label29.Size = New System.Drawing.Size(98, 18)
        Me.Label29.TabIndex = 104
        Me.Label29.Text = "- Open Drawer"
        '
        'Label28
        '
        Me.Label28.AutoSize = True
        Me.Label28.BackColor = System.Drawing.Color.Transparent
        Me.Label28.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label28.ForeColor = System.Drawing.Color.FromArgb(CType(CType(192, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer))
        Me.Label28.Location = New System.Drawing.Point(192, 25)
        Me.Label28.Name = "Label28"
        Me.Label28.Size = New System.Drawing.Size(22, 18)
        Me.Label28.TabIndex = 104
        Me.Label28.Text = "F3"
        '
        'Label27
        '
        Me.Label27.AutoSize = True
        Me.Label27.BackColor = System.Drawing.Color.Transparent
        Me.Label27.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label27.ForeColor = System.Drawing.Color.Black
        Me.Label27.Location = New System.Drawing.Point(98, 25)
        Me.Label27.Name = "Label27"
        Me.Label27.Size = New System.Drawing.Size(89, 18)
        Me.Label27.TabIndex = 104
        Me.Label27.Text = "- Item Search"
        '
        'Label26
        '
        Me.Label26.AutoSize = True
        Me.Label26.BackColor = System.Drawing.Color.Transparent
        Me.Label26.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label26.ForeColor = System.Drawing.Color.FromArgb(CType(CType(192, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer))
        Me.Label26.Location = New System.Drawing.Point(77, 25)
        Me.Label26.Name = "Label26"
        Me.Label26.Size = New System.Drawing.Size(22, 18)
        Me.Label26.TabIndex = 104
        Me.Label26.Text = "F2"
        '
        'Label25
        '
        Me.Label25.AutoSize = True
        Me.Label25.BackColor = System.Drawing.Color.Transparent
        Me.Label25.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label25.ForeColor = System.Drawing.Color.Black
        Me.Label25.Location = New System.Drawing.Point(34, 25)
        Me.Label25.Name = "Label25"
        Me.Label25.Size = New System.Drawing.Size(39, 18)
        Me.Label25.TabIndex = 104
        Me.Label25.Text = "- Exit"
        '
        'Label5
        '
        Me.Label5.AutoSize = True
        Me.Label5.BackColor = System.Drawing.Color.Transparent
        Me.Label5.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label5.ForeColor = System.Drawing.Color.FromArgb(CType(CType(192, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer))
        Me.Label5.Location = New System.Drawing.Point(8, 25)
        Me.Label5.Name = "Label5"
        Me.Label5.Size = New System.Drawing.Size(27, 18)
        Me.Label5.TabIndex = 104
        Me.Label5.Text = "Esc"
        '
        'frmRetailInvReturn
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(7, 19)
        Me.BackColor = System.Drawing.SystemColors.ActiveCaption
        Me.ClientSize = New System.Drawing.Size(851, 667)
        Me.ControlBox = False
        Me.Controls.Add(Me.GroupPanel1)
        Me.Controls.Add(Me.lblSaleTog)
        Me.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.ForeColor = System.Drawing.Color.Lavender
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D
        Me.KeyPreview = True
        Me.Location = New System.Drawing.Point(50, 10)
        Me.MaximizeBox = False
        Me.MinimizeBox = False
        Me.Name = "frmRetailInvReturn"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.Manual
        CType(Me.dgReturnList, System.ComponentModel.ISupportInitialize).EndInit()
        Me.GroupBox1.ResumeLayout(False)
        Me.GroupBox1.PerformLayout()
        Me.GroupPanel1.ResumeLayout(False)
        Me.GroupPanel1.PerformLayout()
        Me.GroupBox2.ResumeLayout(False)
        Me.GroupBox2.PerformLayout()
        Me.ResumeLayout(False)

    End Sub

#End Region
    Public Function GetPrinterStatus() As String
        Dim printerClass As _
            New System.Management.ManagementClass("Win32_Printer")
        Dim printers As System.Management.ManagementObjectCollection = _
            printerClass.GetInstances()
        Dim printer As System.Management.ManagementObject
        Dim pstat As String
        'Dim moReturn As Management.ManagementObjectCollection
        'Dim moSearch As Management.ManagementObjectSearcher
        'Dim mo As Management.ManagementObject
        'moSearch = New Management.ManagementObjectSearcher("Select * from Win32_Printer")
        'moReturn = moSearch.Get
        'For Each mo In moReturn
        '    Dim strOut As String
        '    strOut = String.Format("{0} - Status {1}", mo("Name"), mo("status"))
        'Next

        For Each printer In printers
            If CStr(printer("Name")) = PosPrinterName Then
                Dim pstatus As Boolean
                pstatus = printer("WorkOffline").ToString().ToLower()
                pstat = printer("PrinterStatus").ToString
            End If
        Next printer
        '
        Dim PrnCheck As PrinterStatusCheck = New PrinterStatusCheck
        Dim prnStr, jbStr As String
        pstat = PrnCheck.CheckPrinter(prnStr, jbStr)
        '
        Return pstat & prnStr & jbStr
    End Function
    Private Sub ICretailInvoice_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        GVposTotal = 0
        SavedID = 0
        PosCusName = ""
        PosCusID = 0
        OriginalPrice = 0
        txtRtnInvDate.Text = Now.ToShortDateString
        Dim ICdata As New ICdataLogic
        txtRtnInvNo.Text = ICdata.GetNextReturn(ShowroomID, TerminalID)
        txtSuspend.Text = CStr(ICdata.GetSuspendedRtnCount(CompanyID, ShowroomID, TerminalID))
        If txtSuspend.Text.Trim <> "" Then
            lblSuspend.ForeColor = Color.Red
            txtSuspend.ForeColor = Color.Red
        Else
            txtSuspend.Text = "0"
            lblSuspend.ForeColor = Color.Lavender
            txtSuspend.ForeColor = Color.Lavender
        End If
        Dim PosMode As DataSet
        PosMode = ICdata.GetPosMode(ShowroomID, TerminalID)
        PrinterEnabled = PosMode.Tables(0).Rows(0).Item("PrinterEnabled")
        PoleEnabled = PosMode.Tables(0).Rows(0).Item("PoleEnabled")
        DrawerEnabled = PosMode.Tables(0).Rows(0).Item("DrawerEnabled")
        PosPrinterName = PosMode.Tables(0).Rows(0).Item("PosPrinterName")
        PolePrinterName = PosMode.Tables(0).Rows(0).Item("PolePrinterName")
        '
        'Dim pStatus As String
        'pStatus = GetPrinterStatus()
        '
        Dim invoiceDS As DataSet = New DataSet("Invoice")
        Dim InvoiceTable As DataTable = invoiceDS.Tables.Add("InvoiceLines")

        InvoiceTable.Columns.Add("ItemCode", Type.GetType("System.String"))
        InvoiceTable.Columns.Add("ItemName", Type.GetType("System.String"))
        InvoiceTable.Columns.Add("Quantity", Type.GetType("System.String"))
        InvoiceTable.Columns.Add("UnitPrice", Type.GetType("System.String"))
        InvoiceTable.Columns.Add("DiscountPercent", Type.GetType("System.String"))
        InvoiceTable.Columns.Add("DiscountAmount", Type.GetType("System.String"))
        InvoiceTable.Columns.Add("TotalPrice", Type.GetType("System.String"))
        InvoiceTable.Columns.Add("OrgPrice", Type.GetType("System.String"))
        InvoiceTable.Columns.Add("ProdID", Type.GetType("System.String"))

        With dgReturnList
            .SetDataBinding(invoiceDS, "InvoiceLines")
            .TableStyles.Clear()
            .CaptionBackColor = System.Drawing.Color.SlateBlue
            .CaptionForeColor = System.Drawing.Color.LemonChiffon
            .AllowSorting = True
            .AlternatingBackColor = System.Drawing.Color.AliceBlue
            .ParentRowsBackColor = System.Drawing.Color.Lavender
            .ParentRowsForeColor = System.Drawing.Color.SlateBlue
            .HeaderBackColor = System.Drawing.Color.LemonChiffon
            .AllowNavigation = False
            .ParentRowsVisible = False
            .RowHeadersVisible = False
        End With
        Dim cm As CurrencyManager = BindingContext(dgReturnList.DataSource, dgReturnList.DataMember)
        Dim dv As DataView = cm.List
        dv.AllowNew = False

        'Set data grid Table Style
        Dim tblCrrncMngr As CurrencyManager = CType(BindingContext(invoiceDS.Tables.Item("InvoiceLines")), CurrencyManager)
        Dim TblStyle As New DataGridTableStyle
        With TblStyle
            .MappingName = "InvoiceLines"
            .AlternatingBackColor = Color.AliceBlue
            .HeaderFont = New Font("Tahoma", 8.0!, FontStyle.Bold)
            .PreferredColumnWidth = 160
            .HeaderBackColor = Color.LightSlateGray
            .HeaderForeColor = Color.LightCyan
            .PreferredRowHeight = 15
            .RowHeadersVisible = False
            .RowHeaderWidth = 0
            .ReadOnly = True
            ' .RowHeaderWidth = 10

            ' Set column styles
            With .GridColumnStyles
                .Add(New DataGridTextBoxColumn(tblCrrncMngr.GetItemProperties.Item("InvoiceTable")))
                With .Item(0)
                    .MappingName = "ItemCode"
                    .Width = 175
                    .NullText = String.Empty
                End With
                .Add(New DataGridTextBoxColumn(tblCrrncMngr.GetItemProperties.Item("InvoiceTable")))
                With .Item(1)
                    .MappingName = "ItemName"
                    .Width = 303
                    .NullText = String.Empty
                End With
                .Add(New DataGridTextBoxColumn(tblCrrncMngr.GetItemProperties.Item("InvoiceTable")))
                With .Item(2)
                    .MappingName = "Quantity"
                    .Width = 60
                    .NullText = String.Empty
                    .Alignment = HorizontalAlignment.Right
                End With
                .Add(New DataGridTextBoxColumn(tblCrrncMngr.GetItemProperties.Item("InvoiceTable")))
                '.Add(New RustemSoft.DataGridColumns.DataGridNumericColumn(, True, , , , , 3))
                With .Item(3)
                    .MappingName = "UnitPrice"
                    .Width = 58
                    .NullText = String.Empty
                    .Alignment = HorizontalAlignment.Right
                End With
                .Add(New DataGridTextBoxColumn(tblCrrncMngr.GetItemProperties.Item("InvoiceTable")))
                With .Item(4)
                    .MappingName = "DiscountPercent"
                    .Width = 58
                    .NullText = String.Empty
                    .Alignment = HorizontalAlignment.Right
                End With
                .Add(New DataGridTextBoxColumn(tblCrrncMngr.GetItemProperties.Item("InvoiceTable")))
                With .Item(5)
                    .MappingName = "DiscountAmount"
                    .Width = 58
                    .NullText = String.Empty
                    .Alignment = HorizontalAlignment.Right
                End With
                .Add(New DataGridTextBoxColumn(tblCrrncMngr.GetItemProperties.Item("InvoiceTable")))
                With .Item(6)
                    .MappingName = "TotalPrice"
                    .Width = 63
                    .NullText = String.Empty
                    .Alignment = HorizontalAlignment.Right
                    .ReadOnly = True
                End With
                .Add(New DataGridTextBoxColumn(tblCrrncMngr.GetItemProperties.Item("InvoiceTable")))
                With .Item(7)
                    .MappingName = "OrgPrice"
                    .Width = 0
                    .NullText = String.Empty
                    .ReadOnly = True
                End With
                .Add(New DataGridTextBoxColumn(tblCrrncMngr.GetItemProperties.Item("InvoiceTable")))
                With .Item(8)
                    .MappingName = "ProdID"
                    .Width = 0
                    .NullText = String.Empty
                    .ReadOnly = True
                End With
            End With
        End With
        dgReturnList.TableStyles.Add(TblStyle)
        Dim GridItemCodeColumn As DataGridTextBoxColumn = dgReturnList.TableStyles(0).GridColumnStyles(0)
        'Dim GridPriceColumn As DataGridNumericColumn = DataGrid1.TableStyles(0).GridColumnStyles(3)
        'GridPriceColumn.Alignment = HorizontalAlignment.Right
        'AddHandler GridItemCodeColumn.lostfocus, AddressOf GridItemCodeColumn_LostFocus
        'dgformat()
        txtCode.Focus()
    End Sub
    Private Sub dgformat()
        Dim grdTableStyle As New DataGridTableStyle
        With grdTableStyle
            .AlternatingBackColor = Color.AliceBlue
            .HeaderFont = New Font("Tahoma", 8.0!, FontStyle.Bold)
            .MappingName = "GROUP"
            .PreferredColumnWidth = 160
            .HeaderBackColor = Color.LightSlateGray
            .HeaderForeColor = Color.LightCyan
            .PreferredRowHeight = 15
            .RowHeadersVisible = False
            .RowHeaderWidth = 0
        End With
        Dim cs1 As DataGridColumnStyle
        cs1 = New DataGridTextBoxColumn
        'cs1.MappingName = "ItemCode"
        cs1.Width = 115
        cs1.NullText = String.Empty
        cs1.ReadOnly = True
        grdTableStyle.GridColumnStyles.Add(cs1)
        '
        cs1 = New DataGridTextBoxColumn
        'cs1.MappingName = "ItemName"
        cs1.Width = 225
        cs1.NullText = String.Empty
        cs1.ReadOnly = True
        grdTableStyle.GridColumnStyles.Add(cs1)
        '
        cs1 = New DataGridTextBoxColumn
        'cs1.MappingName = "Quantity"
        cs1.Width = 60
        cs1.NullText = String.Empty
        cs1.Alignment = HorizontalAlignment.Right
        cs1.ReadOnly = True
        grdTableStyle.GridColumnStyles.Add(cs1)
        '
        cs1 = New DataGridTextBoxColumn
        'cs1.MappingName = "UnitPrice"
        cs1.Width = 58
        cs1.NullText = String.Empty
        cs1.Alignment = HorizontalAlignment.Right
        cs1.ReadOnly = True
        grdTableStyle.GridColumnStyles.Add(cs1)
        '
        cs1 = New DataGridTextBoxColumn
        'cs1.MappingName = "DiscountPercent"
        cs1.Width = 58
        cs1.Alignment = HorizontalAlignment.Right
        cs1.NullText = String.Empty
        cs1.ReadOnly = True
        grdTableStyle.GridColumnStyles.Add(cs1)
        '
        cs1 = New DataGridTextBoxColumn
        'cs1.MappingName = "TotalPrice"
        cs1.Width = 63
        cs1.NullText = String.Empty
        cs1.Alignment = HorizontalAlignment.Right
        cs1.ReadOnly = True
        grdTableStyle.GridColumnStyles.Add(cs1)
        '
        cs1 = New DataGridTextBoxColumn
        'cs1.MappingName = "TotalPrice"
        cs1.Width = 0
        cs1.NullText = String.Empty
        cs1.Alignment = HorizontalAlignment.Right
        cs1.ReadOnly = True
        grdTableStyle.GridColumnStyles.Add(cs1)
        '
        cs1 = New DataGridTextBoxColumn
        'cs1.MappingName = "ProdID"
        cs1.Width = 0
        cs1.NullText = String.Empty
        cs1.Alignment = HorizontalAlignment.Right
        cs1.ReadOnly = True
        grdTableStyle.GridColumnStyles.Add(cs1)
        '
        dgReturnList.TableStyles.Add(grdTableStyle)
    End Sub
    Public Sub LoadSavedInvoiceNumbers(ByVal InvStatus As String)
        Dim ICdata As New ICdataLogic
        Dim ds2 As DataSet
        ds2 = ICdata.GetSavedInvoiceNumbers(ShowroomID, CashierID, InvStatus)
        'cmbSaved.DataSource = ds2.Tables(0)
        'cmbSaved.ValueMember = "InvID"
        'cmbSaved.DisplayMember = "InvNO"
        ICdata = Nothing
    End Sub
    Private Sub tbPrice_LostFocus(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtLinePrice.LostFocus
        If txtLinePrice.Text.Trim <> "" Then
            If IsNumeric(txtLinePrice.Text) Then
                If Decimal.Parse(txtLinePrice.Text) > 10000 Then
                    'MsgBox("Invalid Price", MsgBoxStyle.Information, "Inventory Manager")
                    txtCode.Text = txtLinePrice.Text
                    txtLinePrice.Clear()
                    txtCode.Focus()
                    SendKeys.Send("{Tab}")
                    Exit Sub
                End If
                If OriginalPrice > Decimal.Parse(txtLinePrice.Text) Then
                    txtLineDiscA.Text = OriginalPrice - Decimal.Parse(txtLinePrice.Text)
                    txtLinePrice.Text = CStr(OriginalPrice)
                    txtLineDiscA.Text = FormatNumber(txtLineDiscA.Text, 3)
                End If
                CalculateLineTotal()
            Else
                'MsgBox("Only numbers allowed for Price", MsgBoxStyle.Information, "Inventory Manager")
                txtCode.Text = txtLinePrice.Text
                txtLinePrice.Clear()
                txtCode.Focus()
                SendKeys.Send("{Tab}")
                Exit Sub
            End If
        Else
            txtLinePrice.Text = "0"
        End If
        'tbDisA.Focus()
    End Sub
    Private Sub btnCancelClick()
        If txtNetAmt.Text.Trim <> "" Then
            If Decimal.Parse(txtNetAmt.Text) > 0 Then
                Dim Result As DialogResult
                Result = MsgBox("Current invoice grid is not empty," & vbLf & "Do you wish to VOID it ?", "Inventory Manager", MsgBoxStyle.YesNoCancel)
                Dim Response As String
                Select Case Result
                    Case DialogResult.Yes
                        Response = InsertInvData("VOID")
                        ClearGridAndScreen()
                    Case DialogResult.No
                        Response = InsertInvData("SAVE")
                        ClearGridAndScreen()
                        Exit Sub
                    Case DialogResult.Cancel
                        Exit Sub
                End Select
            End If
        End If
        Me.Hide()
    End Sub
    Private Function ValidateProductCode() As Boolean
        Dim ICdata As New ICdataLogic
        Try
            Dim ds As DataSet
            ds = ICdata.GetBarCodeDetails(CompanyID, txtCode.Text)
            If ds.Tables(0).Rows.Count() = 0 Then
                ICdata = Nothing
                Return False
            End If
            '
            If ICdata.IsDiscontinuedProduct(CompanyID, ds.Tables(0).Rows(0).Item("ProductID")) = False Then
                ICdata = Nothing
                Return False
            End If
            '

            txtDescription.Text = ds.Tables(0).Rows(0).Item("SHORTDESCRIPTIONE").ToString()
            txtLinePrice.Text = ds.Tables(0).Rows(0).Item("FIRSTPRICE").ToString()
            txtProdId.Text = ds.Tables(0).Rows(0).Item("PRODUCTID").ToString()
            txtLineQty.Text = "1"
            ICdata = Nothing
            Return True
        Catch ex As Exception
            ICdata = Nothing
            'MsgBox("Unable to satisfy your request." & vbLf & "Try again later.", MsgBoxStyle.Critical, "Inventory Manager")
            Return False
        End Try
    End Function
    Dim icinvprodpop As Object
    Public Sub SearchProductInvoices()
        If icinvprodpop Is Nothing Then
            icinvprodpop = New frmItemSearchPOS
            icinvprodpop.ShowDialog()
        Else
            icinvprodpop.ShowDialog()
        End If
    End Sub

    Private Sub SingleMultiTog()
        If tbSingleTog.Text = "Multi-Qty" Then
            tbSingleTog.Text = "Qty"
        Else
            tbSingleTog.Text = "Multi-Qty"
        End If
        txtCode.Focus()
    End Sub

    Private Sub tbQty_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtLineQty.LostFocus
        If txtLineQty.Text.Trim <> "" Then
            If IsNumeric(txtLineQty.Text) Then
                If Decimal.Parse(txtLineQty.Text) > 10000 Then
                    'MsgBox("Invalid Qty", MsgBoxStyle.Information, "Inventory Manager")
                    txtCode.Text = txtLineQty.Text
                    txtLineQty.Text = "1"
                    txtCode.Focus()
                    SendKeys.Send("{Tab}")
                    Exit Sub
                End If
            Else
                'MsgBox("Only numbers allowed for Quantity", MsgBoxStyle.Information, "Inventory Manager")
                txtCode.Text = txtLineQty.Text
                txtLineQty.Text = "1"
                txtCode.Focus()
                SendKeys.Send("{Tab}")
                Exit Sub
            End If
        Else
            txtLineQty.Text = "1"
        End If
        CalculateLineTotalPrice()
    End Sub
    Private Sub CalculateLineTotalPrice()
        If txtLineQty.Text.Trim <> "" Then
            If IsNumeric(txtLineQty.Text) Then
                If txtLinePrice.Text.Trim <> "" Then
                    If IsNumeric(txtLinePrice.Text) Then
                        If Decimal.Parse(txtLinePrice.Text) > 10000 Then
                            MsgBox("Invalid Price", MsgBoxStyle.Information, "Inventory Manager")
                            txtLinePrice.Text = "1"
                            txtLinePrice.Focus()
                            Exit Sub
                        End If
                        CalculateLineTotal()
                    Else
                        MsgBox("Only numbers allowed for Price", MsgBoxStyle.Information, "Inventory Manager")
                        txtLinePrice.Focus()
                        Exit Sub
                    End If
                End If
            Else
                MsgBox("Only numbers allowed for Quantity", MsgBoxStyle.Information, "Inventory Manager")
                txtLineQty.Focus()
                Exit Sub
            End If
        End If
    End Sub
    Private Sub CalculateLineTotal()
        If txtLineDiscP.Text.Trim <> "" Then
            If Not IsNumeric(txtLineDiscP.Text) Then
                MsgBox("Only numbers allowed for Discount Percent", MsgBoxStyle.Information, "Inventory Manager")
                txtLineDiscP.Focus()
                Exit Sub
            End If
        Else
            txtLineDiscP.Text = "0"
        End If
        If txtLineDiscA.Text.Trim <> "" Then
            If Not IsNumeric(txtLineDiscA.Text) Then
                MsgBox("Only numbers allowed for Discount Amount", MsgBoxStyle.Information, "Inventory Manager")
                txtLinePrice.Focus()
                Exit Sub
            End If
        Else
            txtLineDiscA.Text = "0"
        End If
        Dim ltot As Decimal
        Dim disp As Decimal
        Dim disa As Decimal
        Dim gtot As Decimal
        ltot = Decimal.Parse(txtLineQty.Text) * Decimal.Parse(txtLinePrice.Text)
        ltot = Decimal.Round(ltot, 2)
        gtot = FormatNumber(ltot, 3)
        If Decimal.Parse(txtLineDiscP.Text) > 0 Then
            disa = (Decimal.Parse(txtLineDiscP.Text) / 100) * ltot
            disa = Decimal.Round(disa, 2)
            disa = FormatNumber(disa, 3)
            txtLineDiscA.Text = disa.ToString()
            gtot = ltot - disa
            gtot = Decimal.Round(gtot, 2)
            gtot = FormatNumber(gtot, 3)
        Else
            If Decimal.Parse(txtLineDiscP.Text) < 0 Then
                MsgBox("Only positive numbers allowed for Discount Percent", MsgBoxStyle.Information, "Inventory Manager")
                txtLineDiscP.Focus()
                Exit Sub
            End If
        End If
        If Decimal.Parse(txtLineDiscA.Text) > 0 Then
            gtot = ltot - Decimal.Parse(txtLineDiscA.Text)
            disp = (Decimal.Parse(txtLineDiscA.Text) / ltot) * 100
            disp = Decimal.Round(disp, 2)
            disp = FormatNumber(disp, 2)
            txtLineDiscP.Text = disp.ToString()
            gtot = FormatNumber(gtot, 3)
            If Decimal.Parse(txtLineDiscA.Text) > ltot Then
                MsgBox("Discount more than total not allowed.", MsgBoxStyle.Information, "Inventory Manager")
                txtLineDiscP.Focus()
                Exit Sub
            End If
        Else
            If Decimal.Parse(txtLineDiscA.Text) < 0 Then
                MsgBox("Only positive numbers allowed for Discount Amount", MsgBoxStyle.Information, "Inventory Manager")
                txtLineDiscP.Focus()
                Exit Sub
            End If
        End If
        txtLineTotalAmt.Text = gtot.ToString()
    End Sub
    Private Sub DataGrid1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles dgReturnList.MouseUp
        Dim pt As New Point(e.X, e.Y)
        Dim hti As DataGrid.HitTestInfo = dgReturnList.HitTest(pt)
        If hti.Type = DataGrid.HitTestType.Cell Then
            dgReturnList.CurrentCell = New DataGridCell(hti.Row, hti.Column)
            dgReturnList.Select(hti.Row)
            txtCode.Focus()
        End If
    End Sub
    Private Sub tbDisp_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtLineDiscP.LostFocus
        If txtLineDiscP.Text.Trim <> "" Then
            If Not IsNumeric(txtLineDiscP.Text) Then
                'MsgBox("Only numbers allowed for Cash Paid.", MsgBoxStyle.Information, "Inventory Manager")
                txtCode.Text = txtLineDiscP.Text
                txtLineDiscP.Clear()
                txtCode.Focus()
                SendKeys.Send("{Tab}")
                'tbCashPaid.Focus()
                Exit Sub
            Else
                If txtLineTotalAmt.Text.Trim <> "" And txtLineTotalAmt.Text.Trim <> "0.000" Then
                    If Decimal.Parse(txtLineDiscP.Text) > 100 Then
                        txtCode.Text = txtLineDiscP.Text
                        txtLineDiscP.Clear()
                        txtCode.Focus()
                        SendKeys.Send("{Tab}")
                        Exit Sub
                    End If
                Else
                    If txtLineTotalAmt.Text.Trim = "" Or txtLineTotalAmt.Text.Trim = "0.000" Then
                        txtCode.Text = txtLineDiscP.Text
                        txtLineDiscP.Clear()
                        txtCode.Focus()
                        SendKeys.Send("{Tab}")
                        Exit Sub
                    End If
                End If
            End If
        End If

        CalculateLineTotalPrice()
    End Sub

    Private Sub tbgDisP_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtDiscP.LostFocus
        If txtDiscP.Text.Trim <> "" Then
            If Not IsNumeric(txtDiscP.Text) Then
                'MsgBox("Only numbers allowed for Cash Paid.", MsgBoxStyle.Information, "Inventory Manager")
                txtCode.Text = txtDiscP.Text
                txtDiscP.Clear()
                txtCode.Focus()
                SendKeys.Send("{Tab}")
                'tbCashPaid.Focus()
                Exit Sub
            Else
                If txtGrossAmt.Text.Trim <> "" And txtGrossAmt.Text.Trim <> "0.000" Then
                    If Decimal.Parse(txtDiscP.Text) > 100 Then
                        txtCode.Text = txtDiscP.Text
                        txtDiscP.Clear()
                        txtCode.Focus()
                        SendKeys.Send("{Tab}")
                        Exit Sub
                    End If
                Else
                    If txtGrossAmt.Text.Trim = "" Or txtGrossAmt.Text.Trim = "0.000" Then
                        txtCode.Text = txtDiscP.Text
                        txtDiscP.Clear()
                        txtCode.Focus()
                        SendKeys.Send("{Tab}")
                        Exit Sub
                    End If
                End If
            End If
        End If

        If txtGrossAmt.Text.Trim <> "" Then
            If Decimal.Parse(txtGrossAmt.Text) > 0 Then
                GrossTotal = Decimal.Parse(txtGrossAmt.Text)
                If txtDiscP.Text.Trim <> "" Then
                    If IsNumeric(txtDiscP.Text) Then
                        If Decimal.Parse(txtDiscP.Text) > 0 Then
                            txtDiscP.Text = Decimal.Round(Decimal.Parse(txtDiscP.Text), 2).ToString
                            Dim disamt As Decimal = (Decimal.Parse(txtDiscP.Text) / 100) * GrossTotal
                            disamt = Decimal.Round(disamt, 2)
                            txtDiscAmt.Text = FormatNumber(disamt, 3)
                        End If
                    Else
                        MsgBox("Discount percent should be numeric", MsgBoxStyle.Critical, "Inventory Manager")
                        txtDiscP.Text = "0"
                        txtDiscAmt.Focus()
                        Exit Sub
                    End If
                Else
                    txtDiscP.Text = "0"
                    If txtDiscAmt.Text.Trim <> "" Then
                        If IsNumeric(txtDiscAmt.Text) Then
                            If Decimal.Parse(txtDiscAmt.Text) > 0 Then
                                Dim discent As Decimal = (Decimal.Parse(txtDiscAmt.Text) / GrossTotal) * 100
                                discent = Decimal.Round(discent, 2)
                                txtDiscP.Text = FormatNumber(discent, 2)
                                txtDiscAmt.Text = FormatNumber(txtDiscAmt.Text, 3)
                            End If
                        Else
                            MsgBox("Discount amount should be numeric", MsgBoxStyle.Critical, "Inventory Manager")
                            txtDiscAmt.Text = "0"
                            txtDiscAmt.Focus()
                            Exit Sub
                        End If
                    Else
                        txtDiscAmt.Text = "0"
                    End If
                End If
                txtNetAmt.Text = FormatNumber(GrossTotal, 3)
                If txtDiscAmt.Text.Trim <> "" Then
                    txtNetAmt.Text = FormatNumber(GrossTotal - Decimal.Parse(txtDiscAmt.Text), 3)
                End If
                If Decimal.Parse(txtDiscAmt.Text) > Decimal.Parse(txtGrossAmt.Text) Then
                    MsgBox("Discount is more than gross amount", MsgBoxStyle.Critical, "Inventory Manager")
                    txtDiscP.Text = "0"
                    txtDiscAmt.Text = "0"
                    txtDiscP.Focus()
                    Exit Sub
                End If
                If Decimal.Parse(txtDiscAmt.Text) = Decimal.Parse(txtGrossAmt.Text) Then
                    If MsgBox("Full Amount is discounted." + vbLf + "Do you want to continue?", MsgBoxStyle.YesNo, "Inventory Manager") = MsgBoxResult.No Then
                        txtDiscP.Text = "0"
                        txtDiscAmt.Text = "0"
                        txtDiscP.Focus()
                        Exit Sub
                    End If
                End If
            Else
                'tbgDisA.Focus()
            End If
        Else
            'tbgDisA.Focus()
        End If
    End Sub

    Private Sub tbgDisA_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtDiscAmt.LostFocus
        If txtDiscAmt.Text.Trim <> "" Then
            If Not IsNumeric(txtDiscAmt.Text) Then
                'MsgBox("Only numbers allowed for Cash Paid.", MsgBoxStyle.Information, "Inventory Manager")
                txtCode.Text = txtDiscAmt.Text
                txtDiscAmt.Clear()
                txtCode.Focus()
                SendKeys.Send("{Tab}")
                'tbCashPaid.Focus()
                Exit Sub
            Else
                If txtGrossAmt.Text.Trim <> "" And txtGrossAmt.Text.Trim <> "0.000" Then
                    If Decimal.Parse(txtDiscAmt.Text) > Decimal.Parse(txtGrossAmt.Text) Then
                        txtCode.Text = txtDiscAmt.Text
                        txtDiscAmt.Clear()
                        txtCode.Focus()
                        SendKeys.Send("{Tab}")
                        Exit Sub
                    End If
                Else
                    If txtGrossAmt.Text.Trim = "" Or txtGrossAmt.Text.Trim = "0.000" Then
                        txtCode.Text = txtDiscAmt.Text
                        txtDiscAmt.Clear()
                        txtCode.Focus()
                        SendKeys.Send("{Tab}")
                        Exit Sub
                    End If
                End If
            End If
        End If

        If txtGrossAmt.Text.Trim <> "" Then
            If Decimal.Parse(txtGrossAmt.Text) > 0 Then
                GrossTotal = Decimal.Parse(txtGrossAmt.Text)
                If txtDiscAmt.Text.Trim <> "" Then
                    If IsNumeric(txtDiscAmt.Text) Then
                        If Decimal.Parse(txtDiscAmt.Text) > 0 Then
                            Dim discent As Decimal = (Decimal.Parse(txtDiscAmt.Text) / GrossTotal) * 100
                            discent = Decimal.Round(discent, 2)
                            txtDiscP.Text = FormatNumber(discent, 2)
                            txtDiscAmt.Text = FormatNumber(txtDiscAmt.Text, 3)
                        End If
                    Else
                        MsgBox("Discount should be numeric", MsgBoxStyle.Critical, "Inventory Manager")
                        txtDiscAmt.Text = "0"
                        Exit Sub
                    End If
                Else
                    txtDiscAmt.Text = "0"
                    If txtDiscP.Text.Trim <> "" Then
                        If IsNumeric(txtDiscP.Text) Then
                            If Decimal.Parse(txtDiscP.Text) > 0 Then
                                txtDiscP.Text = Decimal.Round(Decimal.Parse(txtDiscP.Text), 2).ToString
                                Dim disamt As Decimal = (Decimal.Parse(txtDiscP.Text) / 100) * GrossTotal
                                disamt = Decimal.Round(disamt, 2)
                                txtDiscAmt.Text = FormatNumber(disamt, 3)
                            End If
                        Else
                            MsgBox("Discount should be numeric", MsgBoxStyle.Critical, "Inventory Manager")
                            txtDiscP.Text = "0"
                            Exit Sub
                        End If
                    Else
                        txtDiscP.Text = "0"
                    End If
                End If
                txtNetAmt.Text = FormatNumber(GrossTotal, 3)
                If txtDiscAmt.Text.Trim <> "" Then
                    txtNetAmt.Text = FormatNumber(GrossTotal - Decimal.Parse(txtDiscAmt.Text), 3)
                End If
                If Decimal.Parse(txtDiscAmt.Text) > Decimal.Parse(txtGrossAmt.Text) Then
                    txtDiscP.Text = "0"
                    txtDiscAmt.Text = "0"
                    MsgBox("Discount is more than gross amount", MsgBoxStyle.Critical, "Inventory Manager")
                    txtDiscAmt.Focus()
                    Exit Sub
                End If
                If Decimal.Parse(txtDiscAmt.Text) = Decimal.Parse(txtGrossAmt.Text) Then
                    If MsgBox("Full Amount is discounted." + vbLf + "Do you want to continue?", MsgBoxStyle.YesNo, "Inventory Manager") = MsgBoxResult.No Then
                        txtDiscP.Text = "0"
                        txtDiscAmt.Text = "0"
                        txtDiscP.Focus()
                        Exit Sub
                    End If
                End If
                'tbCashPaid.Focus()
            End If
        Else
            'tbCashPaid.Focus()
        End If
        txtCashPaid.Text = txtNetAmt.Text
    End Sub

    Private Sub tbCashPaid_LostFocus(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtCashPaid.LostFocus
        If txtCashPaid.Text.Trim <> "" Then
            If Not IsNumeric(txtCashPaid.Text) Then
                'MsgBox("Only numbers allowed for Cash Paid.", MsgBoxStyle.Information, "Inventory Manager")
                txtCode.Text = txtCashPaid.Text
                txtCashPaid.Clear()
                txtCode.Focus()
                SendKeys.Send("{Tab}")
                'tbCashPaid.Focus()
                Exit Sub
            Else
                If txtNetAmt.Text.Trim <> "" And txtNetAmt.Text.Trim <> "0.000" Then
                    If Decimal.Parse(txtCashPaid.Text) > Decimal.Parse(txtNetAmt.Text) + 1000 Then
                        txtCode.Text = txtCashPaid.Text
                        txtCashPaid.Clear()
                        txtCode.Focus()
                        SendKeys.Send("{Tab}")
                        Exit Sub
                    End If
                Else
                    If txtNetAmt.Text.Trim = "" Or txtNetAmt.Text.Trim = "0.000" Then
                        txtCode.Text = txtCashPaid.Text
                        txtCashPaid.Clear()
                        txtCode.Focus()
                        SendKeys.Send("{Tab}")
                        Exit Sub
                    Else
                        txtCashPaid.Text = FormatNumber(txtCashPaid.Text.Trim, 3)
                    End If
                End If
            End If
        End If
        ShowPayBack()
    End Sub

    Private Sub tbChqAmt_LostFocus(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtChqPaid.LostFocus
        If txtChqPaid.Text.Trim <> "" Then
            If Not IsNumeric(txtChqPaid.Text) Then
                'MsgBox("Only numbers allowed for Cash Paid.", MsgBoxStyle.Information, "Inventory Manager")
                txtCode.Text = txtChqPaid.Text
                txtChqPaid.Clear()
                txtCode.Focus()
                SendKeys.Send("{Tab}")
                'tbCashPaid.Focus()
                Exit Sub
            Else
                If txtNetAmt.Text.Trim <> "" And txtNetAmt.Text.Trim <> "0.000" Then
                    If Decimal.Parse(txtChqPaid.Text) > Decimal.Parse(txtNetAmt.Text) + 1000 Then
                        txtCode.Text = txtChqPaid.Text
                        txtChqPaid.Clear()
                        txtCode.Focus()
                        SendKeys.Send("{Tab}")
                        Exit Sub
                    End If
                Else
                    If txtNetAmt.Text.Trim = "" Or txtNetAmt.Text.Trim = "0.000" Then
                        txtCode.Text = txtChqPaid.Text
                        txtChqPaid.Clear()
                        txtCode.Focus()
                        SendKeys.Send("{Tab}")
                        Exit Sub
                    Else
                        txtChqPaid.Text = FormatNumber(txtChqPaid.Text.Trim, 3)
                    End If
                End If
            End If
        End If
        ShowPayBack()
    End Sub

    Private Sub CalcNet()
        If txtGrossAmt.Text.Trim <> "" Then
            If Decimal.Parse(txtGrossAmt.Text) > 0 Then
                GrossTotal = Decimal.Parse(txtGrossAmt.Text)
                If txtDiscAmt.Text.Trim <> "" Then
                    If Decimal.Parse(txtDiscAmt.Text) > 0 Then
                        Dim discent As Decimal = (Decimal.Parse(txtDiscAmt.Text) / GrossTotal) * 100
                        discent = Decimal.Round(discent, 2)
                        txtDiscP.Text = FormatNumber(discent, 2)
                        txtDiscAmt.Text = FormatNumber(txtDiscAmt.Text, 3)
                    End If
                Else
                    txtDiscAmt.Text = "0"
                    If txtDiscP.Text.Trim <> "" Then
                        If Decimal.Parse(txtDiscP.Text) > 0 Then
                            txtDiscP.Text = Decimal.Round(Decimal.Parse(txtDiscP.Text), 2).ToString
                            Dim disamt As Decimal = (Decimal.Parse(txtDiscP.Text) / 100) * GrossTotal
                            disamt = Decimal.Round(disamt, 2)
                            txtDiscAmt.Text = FormatNumber(disamt, 3)
                        End If
                    Else
                        txtDiscP.Text = "0"
                    End If
                End If
                txtNetAmt.Text = FormatNumber(GrossTotal, 3)
                If txtDiscAmt.Text.Trim <> "" Then
                    txtNetAmt.Text = FormatNumber(GrossTotal - Decimal.Parse(txtDiscAmt.Text), 3)
                End If
            End If
            ShowPayBack()
        End If
    End Sub
    Private Sub ShowPayBack()
        Dim Knet As Decimal
        Dim Chq As Decimal
        Dim Gv As Decimal
        Dim Cash As Decimal
        Dim Net As Decimal
        Dim Paid As Decimal
        Dim Crd As Decimal
        Dim Credit As Decimal
        If txtChqPaid.Text <> "" Then
            Chq = Decimal.Parse(txtChqPaid.Text)
            txtChqPaid.Text = FormatNumber(txtChqPaid.Text.Trim, 3)
        End If
        If txtCashPaid.Text <> "" Then
            Cash = Decimal.Parse(txtCashPaid.Text)
            txtCashPaid.Text = FormatNumber(txtCashPaid.Text.Trim, 3)
        End If
        If txtNetAmt.Text <> "" Then
            Net = Decimal.Parse(txtNetAmt.Text)
            txtNetAmt.Text = FormatNumber(txtNetAmt.Text.Trim, 3)
        End If
        If txtGVPaid.Text <> "" Then
            Gv = Decimal.Parse(txtGVPaid.Text)
            txtGVPaid.Text = FormatNumber(txtGVPaid.Text.Trim, 3)
        End If
        If txtCrAmtPaid.Text <> "" Then
            Credit = Decimal.Parse(txtCrAmtPaid.Text)
            txtCrAmtPaid.Text = FormatNumber(txtCrAmtPaid.Text.Trim, 3)
        End If
        Paid = (Knet + Chq + Cash + Crd + Gv + Credit)
        Net = Paid - Net
        txtTotalPaid.Text = Knet + Chq + Cash + Crd + Gv + Credit
        If IsNumeric(txtTotalPaid.Text) Then
            txtTotalPaid.Text = FormatNumber(txtTotalPaid.Text, 3)
        End If
        If Paid > 0 Then
            txtPayBack.Text = FormatNumber(Net, 3)
        End If
    End Sub
    Private Sub btnSettleClick()
        If GridRows = 0 Then
            MsgBox("There is no product sale on invoice to settle.", MsgBoxStyle.Critical, "Inventory Manager")
            txtCode.Focus()
            Exit Sub
        End If
        If txtGrossAmt.Text.Trim <> "" Then
            If Decimal.Parse(txtGrossAmt.Text) > 0 Then
                GrossTotal = Decimal.Parse(txtGrossAmt.Text)
                If txtDiscAmt.Text.Trim <> "" Then
                    If Decimal.Parse(txtDiscAmt.Text) > 0 Then
                        txtDiscAmt.Text = Decimal.Round(CDec(txtDiscAmt.Text), 2)
                        txtDiscAmt.Text = FormatNumber(txtDiscAmt.Text, 3)
                        txtDiscP.Text = FormatNumber((Decimal.Parse(txtDiscAmt.Text) / GrossTotal) * 100, 2)
                    End If
                End If
                txtNetAmt.Text = FormatNumber(GrossTotal, 3)
                If txtDiscAmt.Text.Trim <> "" Then
                    txtNetAmt.Text = FormatNumber(GrossTotal - Decimal.Parse(txtDiscAmt.Text), 3)
                End If
            End If
        End If
        If txtChqPaid.Text.Trim <> "" Then
            If Decimal.Parse(txtChqPaid.Text) > 0 Then
                If txtChqNo.Text.Trim = "" Then
                    MsgBox("Cheque amount exist without Cheque Number!", MsgBoxStyle.Exclamation, "Inventory Manager")
                    txtChqNo.Focus()
                    Exit Sub
                End If
            End If
        End If
        If txtCrAmtPaid.Text.Trim <> "" Then
            If Decimal.Parse(txtCrAmtPaid.Text) > 0 Then
                If txtCustNameorComment.Text.Trim = "" Then
                    MsgBox("Customer name should be specified for Credit Sale!", MsgBoxStyle.Exclamation, "Inventory Manager")
                    txtCustNameorComment.Focus()
                    Exit Sub
                End If
            End If
        End If

        Dim Net As Double
        Dim GV As Double
        Dim Knet As Double
        Dim Cash As Double
        Dim Chq As Double
        Dim Card As Double
        Dim CreditAmt As Double
        If IsNumeric(txtGVPaid.Text) Then
            GV = CDbl(txtGVPaid.Text)
        End If
        If IsNumeric(txtCashPaid.Text) Then
            Cash = CDbl(txtCashPaid.Text)
        End If
        If IsNumeric(txtChqPaid.Text) Then
            Chq = CDbl(txtChqPaid.Text)
        End If
        If IsNumeric(txtCrAmtPaid.Text) Then
            CreditAmt = CDbl(txtCrAmtPaid.Text)
        End If
        If IsNumeric(txtNetAmt.Text) Then
            Net = CDbl(txtNetAmt.Text)
        End If
        If (GV + Knet + Cash + Chq + Card + CreditAmt) < Net Then
            MsgBox("Net amount not fully settled", MsgBoxStyle.Critical, "Inventory Manager")
            Exit Sub
        End If
        ShowPayBack()
        Dim Response As String
        Response = InsertInvData("POST")
        If Response <> "ERROR" Then
            'MsgBox("Invoice No:" + Response + " Posted.", MsgBoxStyle.Information, "Inventory Manager")
            ClearGridAndScreen()
            txtCode.Focus()
        Else
            MsgBox("Unable to POST this return." & vbLf + "Try again.", MsgBoxStyle.Critical, "Inventory Manager")
        End If
    End Sub

    Private Sub btnVoidClick()
        If GridRows = 0 Then
            MsgBox("There is no product on return to void.", MsgBoxStyle.Critical, "Inventory Manager")
            txtCode.Focus()
            Exit Sub
        End If
        If MsgBox("Are sure to Void this Return?", MsgBoxStyle.YesNo, "Inventory Manager") = MsgBoxResult.Yes Then
            Dim Response As String
            Response = InsertInvData("VOID")
            If Response <> "ERROR" Then
                MsgBox("Return Voucher No:" + Response + " Voided", MsgBoxStyle.Information, "Inventory Manager")
                ClearGridAndScreen()
                txtCode.Focus()
            Else
                MsgBox("Unable to VOID this Return." & vbLf + "Try again.", MsgBoxStyle.Critical, "Inventory Manager")
            End If
        End If
    End Sub

    Private Sub btnSaveClick()
        If GridRows = 0 Then
            MsgBox("There is no product on return to save.", MsgBoxStyle.Critical, "Inventory Manager")
            txtCode.Focus()
            Exit Sub
        End If
        Dim Response As String
        Response = InsertInvData("SAVE")
        If Response <> "ERROR" Then
            MsgBox("Return Voucher No:" + Response + " Saved", MsgBoxStyle.Information, "Inventory Manager")
            ClearGridAndScreen()
            txtCode.Focus()
        Else
            MsgBox("Unable to SAVE this Return." & vbLf + "Try again.", MsgBoxStyle.Critical, "Inventory Manager")
        End If
    End Sub
    Private Sub ClearGridAndScreen()
        Dim cm As CurrencyManager = BindingContext(dgReturnList.DataSource, dgReturnList.DataMember)
        Dim dv As DataView = cm.List
        Dim mrow, drow As Integer
        dv.RowStateFilter = DataViewRowState.Deleted
        drow = dv.Table.Rows.Count
        dv.RowStateFilter = DataViewRowState.CurrentRows
        mrow = dv.Table.Rows.Count
        Dim n As Integer
        For n = mrow To 0 Step -1
            Try
                dv.Delete(n)
            Catch ex As Exception
                Exit For
            End Try
        Next
        SavedID = 0
        txtCode.Clear()
        txtDescription.Clear()
        txtLineQty.Clear()
        txtLinePrice.Clear()
        txtLineDiscP.Clear()
        txtLineDiscA.Clear()
        txtLineTotalAmt.Clear()
        txtChqNo.Clear()
        txtChqPaid.Clear()
        txtCashPaid.Clear()
        'tbPayBack.Clear()
        txtGVPaid.Clear()
        txtCrAmtPaid.Clear()
        txtGrossAmt.Clear()
        txtNetAmt.Clear()
        txtTotalPaid.Clear()
        txtDiscP.Clear()
        txtDiscAmt.Clear()
        txtCustNameorComment.Clear()
        txtTotQty.Clear()
        txtDiscTot.Clear()
        txtProdId.Clear()
        lblNamePrompt.Visible = False
        txtCustNameorComment.Visible = False
        txtCode.Focus()
        Dim ICdata As New ICdataLogic
        txtRtnInvNo.Text = ICdata.GetNextReturn(ShowroomID, TerminalID)
        txtSuspend.Text = CStr(ICdata.GetSuspendedRtnCount(CompanyID, ShowroomID, TerminalID))
        If txtSuspend.Text.Trim <> "" Then
            lblSuspend.ForeColor = Color.Red
            txtSuspend.ForeColor = Color.Red
        Else
            txtSuspend.Text = "0"
            lblSuspend.ForeColor = Color.Lavender
            txtSuspend.ForeColor = Color.Lavender
        End If
        ICdata = Nothing
        'btnFind.PerformClick()
        'SearchedInvNo = ""
        'SearchInvNo = 0
        GridRows = 0
        GrossTotal = 0
        TotQty = 0
    End Sub

    Private Sub btnDeleteClick()
        If MsgBox("Are you sure to delete this line?", MsgBoxStyle.YesNo, "Inventory Manager") = MsgBoxResult.Yes Then
            Try
                Dim CurrentRow As Integer = dgReturnList.CurrentCell.RowNumber
                dgReturnList.Select(CurrentRow)
                Dim cm As CurrencyManager = BindingContext(dgReturnList.DataSource, dgReturnList.DataMember)
                Dim dv As DataView = cm.List
                Dim delcode As String = dv(CurrentRow).Item(0) + ":" + dv(CurrentRow).Item(1)
                PrintInvoiceLine(GridRows, dv(CurrentRow).Item(1), 0 - dv(CurrentRow).Item(2), dv(CurrentRow).Item(6))
                GrossTotal = GrossTotal - dv(CurrentRow).Item(6)
                TotQty = TotQty - dv(CurrentRow).Item(2)
                DisTotal = DisTotal - dv(CurrentRow).Item(5)
                txtGrossAmt.Text = FormatNumber(GrossTotal, 3)
                txtTotQty.Text = FormatNumber(TotQty, 0)
                txtDiscTot.Text = FormatNumber(DisTotal, 3)
                CalcNet()
                dv.Delete(CurrentRow)
                MsgBox("Deleted Return Product:" + delcode, MsgBoxStyle.Information, "Inventory Manager")
            Catch ex As Exception
                MsgBox("Unable to delete", MsgBoxStyle.Exclamation, "Inventory Manager")
            End Try
            txtCode.Focus()
        End If
    End Sub
    Private Function InsertInvData(ByVal InvStatus As String) As String
        Select Case InvStatus
            Case "POST"
                PrintInvoiceFooter("PRINT")
            Case "VOID"
                PrintInvoiceFooter("VOID")
            Case "SAVE"
                PrintInvoiceFooter("SAVE")
        End Select
        Dim InvXml As String
        Dim ICdata As New ICdataLogic
        Dim sb As StringBuilder = New StringBuilder
        sb.Append("<InvoiceDetails>")
        sb.Append("<InvoiceHead>")
        sb.Append("<InvID>" + SavedID.ToString() + "</InvID>")
        sb.Append("<InvNum>" + txtRtnInvNo.Text + "</InvNum>")
        sb.Append("<ShowroomID>" + ShowroomID.ToString() + "</ShowroomID>")
        sb.Append("<WarehouseID>" + WarehouseID.ToString() + "</WarehouseID>")
        sb.Append("<CashierID>" + CashierID.ToString() + "</CashierID>")
        sb.Append("<TerminalID>" + TerminalID.ToString() + "</TerminalID>")
        sb.Append("<ProfileCardNo>" + 0 + "</ProfileCardNo>")
        sb.Append("<ChqNo>" + txtChqNo.Text + "</ChqNo>")
        sb.Append("<ChqAmt>" + txtChqPaid.Text + "</ChqAmt>")
        sb.Append("<CashPaid>" + txtCashPaid.Text + "</CashPaid>")
        sb.Append("<GvValue>" + txtGVPaid.Text + "</GvValue>")
        sb.Append("<CreditAmt>" + txtCrAmtPaid.Text + "</CreditAmt>")
        sb.Append("<CusName>" + txtCustNameorComment.Text + "</CusName>")
        sb.Append("<GrossAmt>" + txtGrossAmt.Text + "</GrossAmt>")
        sb.Append("<DiscP>" + txtDiscP.Text + "</DiscP>")
        sb.Append("<DiscA>" + txtDiscAmt.Text + "</DiscA>")
        sb.Append("<NetAmt>" + txtNetAmt.Text + "</NetAmt>")
        sb.Append("</InvoiceHead>")
        '
        sb.Append("<InvoiceData>")
        Dim mrow As Integer
        Dim cm As CurrencyManager = BindingContext(dgReturnList.DataSource, dgReturnList.DataMember)
        Dim dv As DataView = cm.List
        'dv.RowStateFilter = DataViewRowState.Deleted
        'drow = dv.Table.Rows.Count
        'dv.RowStateFilter = DataViewRowState.CurrentRows
        mrow = dv.Count


        Dim n As Integer
        For n = 0 To mrow - 1
            sb.Append("<InvLine>")
            sb.Append("<InvBarCode>" + dgReturnList.Item(n, 0) + "</InvBarCode>")
            sb.Append("<InvDesc>" + dgReturnList.Item(n, 1) + "</InvDesc>")
            sb.Append("<InvQty>" + dgReturnList.Item(n, 2) + "</InvQty>")
            sb.Append("<InvPrice>" + dgReturnList.Item(n, 3) + "</InvPrice>")
            sb.Append("<InvDisP>" + dgReturnList.Item(n, 4) + "</InvDisP>")
            sb.Append("<InvDisA>" + dgReturnList.Item(n, 5) + "</InvDisA>")
            sb.Append("<InvLtot>" + dgReturnList.Item(n, 6) + "</InvLtot>")
            sb.Append("<InvOrg>" + dgReturnList.Item(n, 7) + "</InvOrg>")
            sb.Append("<ProdID>" + dgReturnList.Item(n, 8) + "</ProdID>")
            sb.Append("</InvLine>")
        Next
        sb.Append("</InvoiceData>")
        sb.Append("</InvoiceDetails>")
        InvXml = sb.ToString()
        Dim Response As String
        Response = ICdata.ProcessRetailReturnData(CompanyID, InvStatus, InvXml)
        Return Response
    End Function

    'Private Sub btnFind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFind.Click
    '    LoadSavedInvoiceNumbers("SAVE")
    'End Sub

    Private Sub btnOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        If SearchInvNo > 0 Then
            If txtNetAmt.Text.Trim <> "" Then
                If Decimal.Parse(txtNetAmt.Text) > 0 Then
                    Dim Result As DialogResult
                    Result = MsgBox("Current return grid is not empty," & vbLf & "Do you wish to VOID it ?", MsgBoxStyle.YesNoCancel, "Inventory Manager")
                    Dim Response As String
                    Select Case Result
                        Case DialogResult.Yes
                            Response = InsertInvData("VOID")
                            ClearGridAndScreen()
                        Case DialogResult.No
                            Response = InsertInvData("SAVE")
                            ClearGridAndScreen()
                            Exit Sub
                        Case DialogResult.Cancel
                            Exit Sub
                    End Select
                End If
            End If
            ClearGridAndScreen()
            GridRows = 0
            PopulateSavedInvoice(SearchInvNo)
            txtRtnInvNo.Text = SearchedInvNo
        End If
    End Sub
    Private Sub PopulateSavedInvoice(ByVal InvID As Integer)
        Dim cm As CurrencyManager = BindingContext(dgReturnList.DataSource, dgReturnList.DataMember)
        Dim dv As DataView = cm.List
        Dim ICdata As New ICdataLogic
        Try
            Dim ds As DataSet
            ds = ICdata.GetRetailReturnHeader(InvID)
            If ds.Tables(0).Rows.Count() = 0 Then
                MsgBox("This is not a saved return." + vbLf + txtCode.Text, MsgBoxStyle.Critical, "Inventory Manager")
                'cmbSaved.Focus()
                Exit Sub
            End If

            txtChqNo.Text = ds.Tables(0).Rows(0).Item("RtnChqNo").ToString()
            txtChqPaid.Text = CDbl(ds.Tables(0).Rows(0).Item("RtnChqAmt")).ToString("#0.000")
            txtCashPaid.Text = CDbl(ds.Tables(0).Rows(0).Item("RtnCashPaid")).ToString("#0.000")
            txtGVPaid.Text = CDbl(ds.Tables(0).Rows(0).Item("RtnGvValue")).ToString("#0.000")
            txtGrossAmt.Text = CDbl(ds.Tables(0).Rows(0).Item("RtnGrossAmt")).ToString("#0.000")
            txtDiscP.Text = CDbl(ds.Tables(0).Rows(0).Item("RtnGDP")).ToString("#0.00")
            txtDiscAmt.Text = CDbl(ds.Tables(0).Rows(0).Item("RtnGDA")).ToString("#0.000")
            txtNetAmt.Text = CDbl(ds.Tables(0).Rows(0).Item("RtnNet")).ToString("#0.000")
            If IsNumeric(txtGrossAmt.Text) Then
                GrossTotal = CDbl(txtGrossAmt.Text)
            End If
            Dim ds2 As DataSet
            ds2 = ICdata.GetReturnDetails(InvID)
            If ds.Tables(0).Rows.Count() = 0 Then
                MsgBox("This is not a saved return." + vbLf + txtCode.Text, MsgBoxStyle.Critical, "Inventory Manager")
                'cmbSaved.Focus()
                Exit Sub
            End If
            SavedID = InvID
            txtRtnInvNo.Text = SearchedInvNo
            dv.AllowNew = True
            Dim nrow As Integer
            Dim drow As DataRow
            '
            PrintInvoiceHeader()
            '
            For Each drow In ds2.Tables(0).Rows
                dv.AddNew()
                dgReturnList.Item(nrow, 0) = drow("RtnBarCode")
                dgReturnList.Item(nrow, 1) = drow("RtnDesc")
                dgReturnList.Item(nrow, 2) = CDbl(drow("RtnQty")).ToString("0")
                dgReturnList.Item(nrow, 3) = CDbl(drow("RtnPrice")).ToString("#0.000")
                If CDbl(drow("RtnDisp")) > 0 Then
                    dgReturnList.Item(nrow, 4) = CDbl(drow("RtnDisp")).ToString("#0.00")
                Else
                    dgReturnList.Item(nrow, 4) = ""
                End If
                If CDbl(drow("RtnDisa")) > 0 Then
                    dgReturnList.Item(nrow, 5) = CDbl(drow("RtnDisa")).ToString("#0.000")
                Else
                    dgReturnList.Item(nrow, 5) = ""
                End If
                If CDbl(drow("RtnLtot")) > 0 Then
                    dgReturnList.Item(nrow, 6) = CDbl(drow("RtnLtot")).ToString("#0.000")
                Else
                    dgReturnList.Item(nrow, 6) = ""
                End If
                If CDbl(drow("RtnOrgPrice")) > 0 Then
                    dgReturnList.Item(nrow, 7) = CDbl(drow("RtnOrgPrice")).ToString("#0.000")
                Else
                    dgReturnList.Item(nrow, 7) = ""
                End If
                dgReturnList.Item(nrow, 8) = drow("RtnProdID")
                TotQty += Decimal.Parse(drow("RtnQty"))
                DisTotal += Decimal.Parse(drow("RtnDisa"))
                PrintInvoiceLine(nrow, dgReturnList.Item(nrow, 1), dgReturnList.Item(nrow, 2), dgReturnList.Item(nrow, 6))
                nrow += 1
            Next
            txtTotQty.Text = FormatNumber(TotQty, 0)
            txtGrossAmt.Text = FormatNumber(GrossTotal, 3)
            txtDiscTot.Text = FormatNumber(DisTotal, 3)

            GridRows = nrow
        Catch ex As Exception
            MsgBox("Unable to satisfy your request." & vbLf & "Try again later.", MsgBoxStyle.Critical, "Inventory Manager")
        Finally
            ICdata = Nothing
        End Try
    End Sub

    Private Sub btnGVClick()
        'If icgv Is Nothing Then
        '    icgv = New ICposGV
        '    icgv.ShowDialog()
        'Else
        '    icgv.ShowDialog()
        'End If
        txtGVPaid.Text = FormatNumber(GVposTotal.ToString(), 3)
        ShowPayBack()
    End Sub

    Private Sub ICretailInvoice_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyUp
        'F1 -   112 
        'F2 -   113
        'F3 -   114
        'F4 -   115
        'F5 -   116
        'F6 -   117
        'F7 -   118 
        'F8 -   119
        'F9 -   120
        'F10-   121
        Select Case e.KeyValue
            Case 13
                '    e.Handled = True
                'SendKeys.Send("{Tab}")
            Case 27     'Esc
                btnCancelClick()
            Case 35     'End
                txtDiscP.Focus()
            Case 36     'Home
                txtCode.Focus()
            Case 112    'F1
                ShowHelpPanel()
            Case 113    'F2
                btnProSearchClick()
                e.Handled = True
            Case 114    'F3
                OpenCashDrawer()
            Case 115    'F4
                SearchProductInvoices()
                e.Handled = True
            Case 116    'F5
                'btnCrcPopClick()
                e.Handled = True
            Case 117    'F6
                btnGVClick()
                e.Handled = True
            Case 118    'F7
                SendKeys.Send("{Tab}")
                btnSettleClick()
            Case 119    'F8
                btnVoidClick()
            Case 120    'F9
                SingleMultiTog()
            Case 121    'F10
                btnProfileClick()
            Case 122    'F11
                btnSaveClick()
            Case 123    'F12
                InvSearch()
                e.Handled = True
            Case 124    'F13
                btnDeleteClick()
            Case 125    'F14
                btnNewClick()
        End Select
    End Sub
    Private Sub ShowHelpPanel()
        Dim strHelp As String
        strHelp = "Esc - Exit" + vbLf
        strHelp = strHelp + "F2  - Item Search" + vbLf
        strHelp = strHelp + "F3  - Open Drawer" + vbLf
        strHelp = strHelp + "F4  - Invoice Search" + vbLf
        'strHelp = strHelp + "F5  - Swipe Credit Card" + vbLf
        strHelp = strHelp + "F6  - Gift Voucher" + vbLf
        strHelp = strHelp + "F7  - Settle Invoice" + vbLf
        strHelp = strHelp + "F8  - Void Invoice" + vbLf
        strHelp = strHelp + "F9  - Single/Multi Togle" + vbLf
        strHelp = strHelp + "F10 - Customer Profile" + vbLf
        strHelp = strHelp + "F11 - Save/Suspend Invoice" + vbLf
        strHelp = strHelp + "F12 - Recall Saved/Suspended" + vbLf
        'strHelp = strHelp + "F13 - Delete Invoice Line" + vbLf
        'strHelp = strHelp + "F14 - New Invoice" + vbLf

        MsgBox(strHelp, MsgBoxStyle.Information, "Inventory Manager")
    End Sub
    Private Sub btnNewClick()
        If txtNetAmt.Text.Trim <> "" Then
            If Decimal.Parse(txtNetAmt.Text) > 0 Then
                Dim Result As DialogResult
                Result = MsgBox("Current return grid is not empty," & vbLf & "Do you wish to VOID it ?", "Inventory Manager", MsgBoxStyle.YesNoCancel)
                Dim Response As String
                Select Case Result
                    Case DialogResult.Yes
                        Response = InsertInvData("VOID")
                        ClearGridAndScreen()
                    Case DialogResult.No
                        Response = InsertInvData("SAVE")
                        ClearGridAndScreen()
                        Exit Sub
                    Case DialogResult.Cancel
                        Exit Sub
                End Select
            End If
        End If
    End Sub
    Private Sub tbCode_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtCode.KeyUp
        If e.KeyCode = Keys.Enter Then
            If txtCode.Text <> "" Then
                SendKeys.Send("{Tab}")
            End If
        End If
    End Sub
    Private Sub InvSearch()
        SearchRtnNo = 0
        'If iciSearch Is Nothing Then
        '    iciSearch = New ICsavedRtnSearch
        '    iciSearch.ShowDialog()
        'Else
        '    iciSearch.ShowDialog()
        'End If
        If SearchRtnNo > 0 Then
            ClearGridAndScreen()
            GridRows = 0
            PopulateSavedInvoice(SearchRtnNo)
            txtRtnInvNo.Text = SearchedRtnNo
        End If
    End Sub
    Private Sub btnProfileClick()
        'If icprofilepop Is Nothing Then
        '    icprofilepop = New ICcustomerAdd
        '    icprofilepop.ShowDialog()
        'Else
        '    icprofilepop.ShowDialog()
        'End If
        lblPosCusName.Text = PosCusName
    End Sub
    Private Sub tbQty_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtLineQty.KeyUp
        If e.KeyCode = Keys.Enter Then
            SendKeys.Send("{Tab}")
        End If
    End Sub

    Private Sub tbPrice_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtLinePrice.KeyUp
        If e.KeyCode = Keys.Enter Then
            SendKeys.Send("{Tab}")
        End If
    End Sub

    Private Sub tbDisp_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtLineDiscP.KeyUp
        If e.KeyCode = Keys.Enter Then
            SendKeys.Send("{Tab}")
        End If
    End Sub

    Private Sub tbDisA_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtLineDiscA.KeyUp
        If e.KeyCode = Keys.Enter Then
            SendKeys.Send("{Tab}")
        End If
    End Sub

    Private Sub tbgDisA_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtDiscAmt.KeyUp
        If e.KeyCode = Keys.Enter Then
            SendKeys.Send("{Tab}")
        End If
    End Sub

    Private Sub tbgDisP_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtDiscP.KeyUp
        If e.KeyCode = Keys.Enter Then
            SendKeys.Send("{Tab}")
        End If
    End Sub

    Private Sub tbKnetAmt_KeyUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs)
        If e.KeyCode = Keys.Enter Then
            SendKeys.Send("{Tab}")
        End If
    End Sub

    Private Sub tbChqNo_KeyUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtChqNo.KeyUp
        If e.KeyCode = Keys.Enter Then
            SendKeys.Send("{Tab}")
        End If
    End Sub

    Private Sub tbChqAmt_KeyUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtChqPaid.KeyUp
        If e.KeyCode = Keys.Enter Then
            SendKeys.Send("{Tab}")
        End If
    End Sub

    Private Sub tbCardAmt_KeyUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs)
        If e.KeyCode = Keys.Enter Then
            SendKeys.Send("{Tab}")
        End If
    End Sub

    Private Sub tbCashPaid_KeyUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtCashPaid.KeyUp
        If e.KeyCode = Keys.Enter Then
            SendKeys.Send("{Tab}")
        End If
    End Sub

    Private Sub tbProfile_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs)
        If e.KeyCode = Keys.Enter Then
            SendKeys.Send("{Tab}")
        End If
    End Sub

    Private Sub tbDisA_Validated(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtLineDiscA.Validated
        If txtCode.Text.Trim <> "" And txtLineQty.Text.Trim <> "" Then
            '
            If txtLineDiscP.Text.Trim <> "" Then
                If Not IsNumeric(txtLineDiscP.Text) Then
                    MsgBox("Only numbers allowed for Discount Percent", MsgBoxStyle.Information, "Inventory Manager")
                    txtLineDiscP.Text = "0"
                    txtLineDiscP.Focus()
                    Exit Sub
                End If
            Else
                txtLineDiscP.Text = "0"
            End If
            If txtLineDiscA.Text.Trim <> "" Then
                If Not IsNumeric(txtLineDiscA.Text) Then
                    MsgBox("Only numbers allowed for Discount Amount", MsgBoxStyle.Information, "Inventory Manager")
                    txtLineDiscA.Text = "0"
                    txtLinePrice.Focus()
                    Exit Sub
                End If
            Else
                txtLineDiscA.Text = "0"
            End If
            Dim ltot As Decimal
            Dim disp As Decimal
            Dim disa As Decimal
            Dim gtot As Decimal
            Dim cm As CurrencyManager = BindingContext(dgReturnList.DataSource, dgReturnList.DataMember)
            Dim dv As DataView = cm.List
            If lblSaleTog.Text = "Return" Then
                Dim rrow As Integer
                rrow = dv.Table.Rows.Count
                Dim n As Integer
                Dim sqty As Double
                For n = rrow To 0 Step -1
                    If dgReturnList.Item(n, 0) = txtCode.Text Then
                        sqty = sqty + Double.Parse(dgReturnList.Item(n, 2))
                    End If
                Next
                If Double.Parse(txtLineQty.Text) > sqty Then
                    MsgBox("Return Qty is more than Sold Qty", MsgBoxStyle.Critical, "Inventory Manager")
                    Exit Sub
                End If
                txtLineQty.Text = 0 - Decimal.Parse(txtLineQty.Text)
            End If
            ltot = Decimal.Parse(txtLineQty.Text) * Decimal.Parse(txtLinePrice.Text)
            ltot = Decimal.Round(ltot, 2)
            gtot = Decimal.Round(gtot, 2)
            gtot = FormatNumber(ltot, 3)
            If Decimal.Parse(txtLineDiscP.Text) > 0 Then
                disa = (Decimal.Parse(txtLineDiscP.Text) / 100) * ltot
                disa = Decimal.Round(disa, 2)
                disa = FormatNumber(disa, 3)
                txtLineDiscA.Text = disa.ToString()
                gtot = ltot - disa
                gtot = Decimal.Round(gtot, 2)
                gtot = FormatNumber(gtot, 3)
            Else
                If Decimal.Parse(txtLineDiscP.Text) < 0 Then
                    MsgBox("Only positive numbers allowed for Discount Percent", MsgBoxStyle.Information, "Inventory Manager")
                    txtLineDiscP.Focus()
                    Exit Sub
                End If
            End If
            If Decimal.Parse(txtLineDiscA.Text) > 0 Then
                gtot = ltot - Decimal.Parse(txtLineDiscA.Text)
                gtot = Decimal.Round(gtot, 2)
                disp = (Decimal.Parse(txtLineDiscA.Text) / ltot) * 100
                disp = Decimal.Round(disp, 2)
                disp = FormatNumber(disp, 2)
                txtLineDiscP.Text = disp.ToString()
                gtot = FormatNumber(gtot, 3)
                If Decimal.Parse(txtLineDiscA.Text) > ltot Then
                    MsgBox("Discount more than total not allowed.", MsgBoxStyle.Information, "Inventory Manager")
                    txtLineDiscA.Text = "0"
                    txtLineDiscP.Text = "0"
                    txtLinePrice.Focus()
                    Exit Sub
                End If
            Else
                If Decimal.Parse(txtLineDiscA.Text) < 0 Then
                    MsgBox("Only positive numbers allowed for Discount Amount", MsgBoxStyle.Information, "Inventory Manager")
                    txtLineDiscA.Text = "0"
                    txtLineDiscP.Text = "0"
                    txtLinePrice.Focus()
                    Exit Sub
                End If
            End If
            txtLineTotalAmt.Text = gtot.ToString()
            GridRows += 1
            ' Print line to printer
            If GridRows = 1 Then
                PrintInvoiceHeader()
            End If
            'PrintInvoiceLine(GridRows, tbDesc.Text, tbQty.Text, tbLtot.Text)
            PrintInvoiceLine(GridRows, txtDescription.Text, txtLineQty.Text, txtLinePrice.Text)
            '
            If GridRows > 13 Then 'And DataGrid1.Width <> 658
                dgReturnList.Width = 658
            End If
            dv.AllowNew = True
            dv.AddNew()
            Dim mrow As Integer

            mrow = dv.Table.Rows.Count
            'If mrow = 0 Then
            dgReturnList.Item(mrow, 0) = txtCode.Text
            dgReturnList.Item(mrow, 1) = txtDescription.Text
            dgReturnList.Item(mrow, 2) = txtLineQty.Text
            If CDbl(txtLinePrice.Text) <> 0 Then
                dgReturnList.Item(mrow, 3) = CDbl(txtLinePrice.Text).ToString("#0.000")
            Else
                dgReturnList.Item(mrow, 3) = ""
            End If
            If CDbl(txtLineDiscP.Text) <> 0 Then
                dgReturnList.Item(mrow, 4) = CDbl(txtLineDiscP.Text).ToString("#0.00")
            Else
                dgReturnList.Item(mrow, 4) = ""
            End If
            If CDbl(txtLineDiscA.Text) <> 0 Then
                dgReturnList.Item(mrow, 5) = CDbl(txtLineDiscA.Text).ToString("#0.000")
            Else
                dgReturnList.Item(mrow, 5) = ""
            End If
            If CDbl(txtLineTotalAmt.Text) <> 0 Then
                dgReturnList.Item(mrow, 6) = CDbl(txtLineTotalAmt.Text).ToString("#0.000")
            Else
                dgReturnList.Item(mrow, 6) = ""
            End If
            If OriginalPrice.Trim <> "" Then
                dgReturnList.Item(mrow, 7) = CDbl(OriginalPrice).ToString("#0.000")
            Else
                dgReturnList.Item(mrow, 7) = ""
            End If
            dgReturnList.Item(mrow, 8) = txtProdId.Text

            GrossTotal += Decimal.Parse(txtLineTotalAmt.Text)
            TotQty += Decimal.Parse(txtLineQty.Text)
            DisTotal += Decimal.Parse(txtLineDiscA.Text)
            txtTotQty.Text = FormatNumber(TotQty, 0)
            txtGrossAmt.Text = FormatNumber(GrossTotal, 3)
            txtDiscTot.Text = FormatNumber(DisTotal, 3)
            If txtDiscP.Text.Trim <> "" Then
                If Decimal.Parse(txtDiscP.Text) > 0 Then
                    txtDiscAmt.Text = FormatNumber((Decimal.Parse(txtDiscP.Text) / 100) * GrossTotal, 3)
                End If
            End If
            If txtDiscAmt.Text.Trim <> "" Then
                If Decimal.Parse(txtDiscAmt.Text) > 0 Then
                    txtDiscP.Text = FormatNumber((Decimal.Parse(txtDiscAmt.Text) / GrossTotal) * 100, 3)
                End If
            End If
            txtNetAmt.Text = FormatNumber(GrossTotal, 3)
            If txtDiscAmt.Text.Trim <> "" Then
                txtNetAmt.Text = FormatNumber(GrossTotal - Decimal.Parse(txtDiscAmt.Text), 3)
            End If
            ShowPayBack()
            dv.AllowNew = False
            txtCode.Clear()
            txtDescription.Clear()
            txtLineQty.Clear()
            txtLinePrice.Clear()
            txtLineDiscP.Clear()
            txtLineDiscA.Clear()
            txtLineTotalAmt.Clear()
            txtProdId.Clear()
            If tbSingleTog.Text = "Multi-Qty" Then
                tbSingleTog.Text = "Qty"
            End If
            If lblSaleTog.Text = "Return" Then
                lblSaleTog.Text = ""
            End If
        End If
        txtCode.Focus()
    End Sub

    Private Sub tbPrice_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtLinePrice.GotFocus
        OriginalPrice = txtLinePrice.Text
    End Sub
    Dim icpSearch As Object
    Private Sub btnProSearchClick()
        icpSearch = New frmProductSearch
        icpSearch.ShowDialog()
        txtCode.Text = SearchBarCode
        txtCode.Focus()
        OriginalPrice = 0
    End Sub

    Private Sub tbQty_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtLineQty.GotFocus
        If txtCode.Text.Trim = "" Then
            txtCode.Focus()
        End If
    End Sub

    Private Sub tbCode_Validated(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtCode.Validated
        txtPayBack.Clear()
        If txtCode.Text.Trim() <> "" Then
            OriginalPrice = 0
            If ValidateProductCode() = True Then
                If tbSingleTog.Text = "Qty" Then
                    txtLinePrice.Focus()
                Else
                    txtLineQty.Focus()
                End If
                'private void PrintMenu_Click(object sender, EventArgs e) {
                '    StringReader streamToPrint = new StringReader (textArea.Text);

                '    //Assumes the default printer
                '    TextPrintDocument pd = new TextPrintDocument(streamToPrint,textArea.Font);

                '    if (storedPageSettings != null) {
                '        pd.DefaultPageSettings = storedPageSettings ;
                '    }

                '    PrintDialog dlg = new PrintDialog() ;
                '    dlg.Document = pd;
                '    DialogResult result = dlg.ShowDialog();

                '    if (result == DialogResult.OK) {
                '        pd.Print();
                '    }
                '}
                'PrintDocument1.Print()
                'C:\Program Files\Microsoft.Net\FrameworkSDK\Samples
                'RawPrinterHelper.SendStringToPrinter(pd.PrinterSettings.PrinterName, s)
            Else
                MsgBox("Invalid Product Code." + vbLf + txtCode.Text, MsgBoxStyle.Critical, "Inventory Manager")
                txtCode.Text = ""
                txtCode.Focus()
            End If
        End If
    End Sub
    Private Sub PrintDocument1_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
        Dim sb As StringBuilder = New StringBuilder
        sb.Append("FantasyWorld 1")
        e.Graphics.DrawString(sb.ToString, New Font("Arial", 10, FontStyle.Regular), Brushes.Black, 10, 10)
    End Sub
    Private Sub PrintInvoiceHeader()
        PrintDialog1.PrinterSettings = New PrinterSettings
        PrintDialog1.PrinterSettings.PrinterName = PosPrinterName
        Dim CompName As String = ConfigurationManager.AppSettings("CompName")
        Dim CompAddr As String = ConfigurationManager.AppSettings("CompAddr")
        Dim CompTel As String = ConfigurationManager.AppSettings("CompTel")
        Dim RtnTitle As String = "RETURN VOUCHER"
        Dim BoldCharsOn, BoldCharsOff As String
        BoldCharsOn = Chr(27) + Chr(69)
        BoldCharsOff = Chr(27) + Chr(70)
        Dim s As String
        s = BoldCharsOn + Space((40 - CompName.Trim.Length) / 2) & CompName.Trim & vbLf + BoldCharsOff

        Try
            If PrinterEnabled = 1 Then
                RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
                s = Space((40 - CompAddr.Trim.Length) / 2) & CompAddr.Trim & vbLf
                RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
                s = Space((40 - CompTel.Trim.Length) / 2) & CompTel.Trim & vbLf
                RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
                s = "-"
                s = s.PadRight(40, "-") & vbLf
                RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
                s = "Shift #:01" & Space(15) & "POS#:" & TerminalID.ToString() & vbLf
                RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
                s = "Cashier:" & UserID.ToString() & Space(15) & "Date:" & Now.ToString("dd/MM/yyyy") & vbLf
                RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
                s = "Rcpt No:" & txtRtnInvNo.Text & Space(9) & "Time:" & Now.ToShortTimeString & vbLf
                RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)

                s = BoldCharsOn + Space((40 - RtnTitle.Trim.Length) / 2) & RtnTitle.Trim & vbLf + BoldCharsOff
                RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
                s = "-"
                s = s.PadRight(40, "-") & vbLf
                RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
                s = "Item Desc." & Space(18) & "Qty" & Space(3) & "Amount" & vbLf
                RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
                s = "-"
                s = s.PadRight(40, "-") & vbLf
                RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
            End If
        Catch ex As Exception
            MsgBox(ex.ToString())
        End Try
    End Sub
    Private Sub PrintInvoiceLine(ByVal GridRows As Integer, ByVal Desc As String, ByVal Qty As String, ByVal Price As String)
        Dim prndesc As String
        Dim RedCharsOn, RedCharsOff As String
        RedCharsOn = Chr(27) + Chr(52)
        RedCharsOff = Chr(27) + Chr(53)
        If Desc.Length > 25 Then
            prndesc = Desc.Substring(0, 25)
        Else
            prndesc = Desc
        End If
        Dim prnqty As String
        If Qty.Length > 6 Then
            prnqty = Qty.Substring(0, 6)
        Else
            prnqty = Qty
        End If
        Dim prntotal As String
        If Price.Length > 9 Then
            prntotal = Price.Substring(0, 9)
        Else
            prntotal = Price
        End If
        Dim s As String = ""
        If Qty >= 0 Then
            s = prndesc.Trim & Space(25 - prndesc.Trim.Length) & Space(6 - prnqty.Trim.Length) & prnqty.Trim & Space(9 - prntotal.Trim.Length) & prntotal.Trim & vbLf
        Else
            s = RedCharsOn & prndesc.Trim & Space(25 - prndesc.Trim.Length) & Space(6 - prnqty.Trim.Length) & prnqty.Trim & Space(9 - prntotal.Trim.Length) & prntotal.Trim & RedCharsOff & vbLf
        End If
        PrintDialog1.PrinterSettings = New PrinterSettings
        'If PoleEnabled = 1 Then
        '    s = "Fantasy World"
        '    PrintDialog1.PrinterSettings.PrinterName = PolePrinterName
        '    RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
        'End If
        PrintDialog1.PrinterSettings.PrinterName = PosPrinterName
        If PrinterEnabled = 1 Then
            RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
        End If
    End Sub
    Private Sub OpenCashDrawer()
        If PrinterEnabled = 1 Then
            PrintDialog1.PrinterSettings = New PrinterSettings
            PrintDialog1.PrinterSettings.PrinterName = PosPrinterName
            Dim OpenDrawChar As String = Chr(7)
            RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, OpenDrawChar)
        End If
    End Sub
    Private Sub PrintInvoiceFooter(ByVal Action As String)
        PrintDialog1.PrinterSettings = New PrinterSettings
        PrintDialog1.PrinterSettings.PrinterName = PosPrinterName
        Dim RedCharsOn, RedCharsOff, OpenDrawChar As String
        RedCharsOn = Chr(27) + Chr(52)
        RedCharsOff = Chr(27) + Chr(53)
        OpenDrawChar = Chr(7)
        If PrinterEnabled = 1 Then
            Dim s As String
            Select Case Action
                Case "PRINT"
                    s = "-"
                    Dim Ldis, Gdis, Grs As Decimal
                    Dim gdistot, grstot As String
                    If IsNumeric(txtDiscTot.Text) Then
                        Ldis = Decimal.Parse(txtDiscTot.Text)
                    End If
                    If IsNumeric(txtDiscAmt.Text) Then
                        Gdis = Decimal.Parse(txtDiscAmt.Text)
                    End If
                    gdistot = CStr(Ldis + Gdis)
                    Grs = Decimal.Parse(txtGrossAmt.Text)
                    Grs = Grs + Ldis
                    grstot = CStr(Grs)
                    's = s.PadRight(40, "-") & vbLf
                    'RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
                    's = vbLf & Space(21) & RedCharsOn & "Total:" & Space(4 - tbtQty.Text.Trim.Length) & tbtQty.Text.Trim & Space(9 - tbGross.Text.Trim.Length) & tbGross.Text.Trim & RedCharsOff & vbLf
                    s = vbLf & Space(21) & RedCharsOn & "Total:" & Space(4 - txtTotQty.Text.Trim.Length) & txtTotQty.Text.Trim & Space(9 - grstot.Trim.Length) & grstot.Trim & RedCharsOff & vbLf
                    RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
                    If grstot <> Decimal.Parse(txtNetAmt.Text) Then
                        's = Space(22) & "Disc:" & Space(9 - tbgDisA.Text.Trim.Length) & tbgDisA.Text.Trim & vbLf
                        s = Space(22) & "Disc:" & Space(4) & Space(9 - gdistot.Trim.Length) & gdistot.Trim & vbLf
                        RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
                        s = Space(23) & "Net:" & Space(4) & Space(9 - txtNetAmt.Text.Trim.Length) & txtNetAmt.Text.Trim & vbLf
                        RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
                    End If
                    s = Space(22) & "Paid:" & Space(4) & Space(9 - txtCashPaid.Text.Trim.Length) & txtCashPaid.Text.Trim & vbLf
                    RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
                    s = Space(20) & "Change:" & Space(4) & Space(9 - txtPayBack.Text.Trim.Length) & txtPayBack.Text.Trim & vbLf
                    RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
                    If IsNumeric(txtCrAmtPaid.Text) Then
                        If Decimal.Parse(txtCrAmtPaid.Text) > 0 Then
                            s = "Debit A\C: " & txtCustNameorComment.Text & vbLf
                            RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
                            s = "Dr.Amount: " & txtCrAmtPaid.Text & vbLf
                            RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
                        End If
                    End If
                    If IsNumeric(txtGVPaid.Text) Then
                        If Decimal.Parse(txtGVPaid.Text) > 0 Then
                            s = "Gift Voucher Settled: " & txtGVPaid.Text & vbLf
                            RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
                        End If
                    End If
                    If IsNumeric(txtChqPaid.Text) Then
                        If Decimal.Parse(txtChqPaid.Text) > 0 Then
                            s = "Cheque No:" & txtChqNo.Text & " Amt: " & txtChqPaid.Text & vbLf
                            RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
                        End If
                    End If
                    s = "-"
                    's = s.PadRight(40, "-") & vbLf
                    'RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
                    s = vbLf & Space(2) & "Goods can be exchanged within 1 week" & vbLf
                    RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
                    s = Space(1) & "No cash refund, Thank You, Visit Again" & vbLf & OpenDrawChar
                    RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
                Case "VOID"
                    s = "-"
                    's = s.PadRight(40, "-") & vbLf
                    'RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
                    s = vbLf & RedCharsOn + Space(10) & " INVOICE CANCELLED" & vbLf + RedCharsOff
                    RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
                Case "SAVE"
                    's = "-"
                    's = s.PadRight(40, "-") & vbLf
                    'RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
                    s = vbLf & RedCharsOn + Space(10) & " INVOICE UNSETTLED" & vbLf + RedCharsOff
                    RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
            End Select
            s = "-"
            's = s.PadRight(40, "-") & vbLf
            'RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
            s = " "
            s = vbLf & s.PadRight(40, " ") & vbLf
            RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
            s = " "
            s = s.PadRight(40, " ") & vbLf
            RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
            s = " "
            s = s.PadRight(40, " ") & vbLf
            RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
            s = " "
            s = s.PadRight(40, " ") & vbLf
            RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
            s = " "
            s = s.PadRight(40, " ") & vbLf
            RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
            s = " "
            s = s.PadRight(40, " ") & vbLf
            RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
            s = " "
            s = s.PadRight(40, " ") & vbLf
            RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
        End If
    End Sub
    Private Sub tbCreditAmt_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtCrAmtPaid.LostFocus
        If txtCrAmtPaid.Text.Trim <> "" Then
            If Not IsNumeric(txtCrAmtPaid.Text) Then
                'MsgBox("Only numbers allowed for Cash Paid.", MsgBoxStyle.Information, "Inventory Manager")
                txtCode.Text = txtCrAmtPaid.Text
                txtCrAmtPaid.Clear()
                txtCode.Focus()
                SendKeys.Send("{Tab}")
                'tbCashPaid.Focus()
                Exit Sub
            Else
                If txtNetAmt.Text.Trim <> "" And txtNetAmt.Text.Trim <> "0.000" Then
                    If Decimal.Parse(txtCrAmtPaid.Text) > Decimal.Parse(txtNetAmt.Text) + 1000 Then
                        txtCode.Text = txtCrAmtPaid.Text
                        txtCrAmtPaid.Clear()
                        txtCode.Focus()
                        SendKeys.Send("{Tab}")
                        Exit Sub
                    End If
                Else
                    If txtNetAmt.Text.Trim = "" Or txtNetAmt.Text.Trim = "0.000" Then
                        txtCode.Text = txtCrAmtPaid.Text
                        txtCrAmtPaid.Clear()
                        txtCode.Focus()
                        SendKeys.Send("{Tab}")
                        Exit Sub
                    Else
                        txtCrAmtPaid.Text = FormatNumber(Decimal.Parse(txtCrAmtPaid.Text.Trim), 3)
                        If CDbl(txtCrAmtPaid.Text) > 0 Then
                            If IsNumeric(txtNetAmt.Text) Then
                                If CDbl(txtCrAmtPaid.Text) > CDbl(txtNetAmt.Text) Then
                                    MsgBox("Credit Amount more than due", MsgBoxStyle.Information, "Inventory Manager")
                                    txtCrAmtPaid.Clear()
                                    txtCrAmtPaid.Focus()
                                End If
                            End If
                            txtCustNameorComment.Focus()
                        End If
                    End If
                End If
            End If
        End If
        ShowPayBack()
    End Sub

    Private Sub tbCreditAmt_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtCrAmtPaid.KeyUp
        If e.KeyCode = Keys.Enter Then
            SendKeys.Send("{Tab}")
        End If
    End Sub

    Private Sub tbDisA_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtLineDiscA.LostFocus
        If txtLineDiscA.Text.Trim <> "" Then
            If Not IsNumeric(txtLineDiscA.Text) Then
                'MsgBox("Only numbers allowed for Cash Paid.", MsgBoxStyle.Information, "Inventory Manager")
                txtCode.Text = txtLineDiscA.Text
                txtLineDiscA.Clear()
                txtCode.Focus()
                SendKeys.Send("{Tab}")
                'tbCashPaid.Focus()
                Exit Sub
            Else
                If txtLineTotalAmt.Text.Trim <> "" And txtLineTotalAmt.Text.Trim <> "0.000" Then
                    If Decimal.Parse(txtLineDiscA.Text) > Decimal.Parse(txtLineTotalAmt.Text) Then
                        txtCode.Text = txtLineDiscA.Text
                        txtLineDiscA.Clear()
                        txtCode.Focus()
                        SendKeys.Send("{Tab}")
                        Exit Sub
                    End If
                Else
                    If txtLineTotalAmt.Text.Trim = "" Or txtLineTotalAmt.Text.Trim = "0.000" Then
                        txtCode.Text = txtLineDiscA.Text
                        txtLineDiscA.Clear()
                        txtCode.Focus()
                        SendKeys.Send("{Tab}")
                        Exit Sub
                    End If
                End If
            End If
        End If
    End Sub


    Private Sub cmdClose_Click(sender As System.Object, e As System.EventArgs) Handles cmdClose.Click
        Me.Close()
    End Sub
End Class
